Commit f5ee5bb9 authored by art's avatar art
Browse files

Support for second optional argument, specifying output file. Use backslash()...

Support for second optional argument, specifying output file. Use backslash() for filename. More one-trick-ponies.
parent 43096513
......@@ -2,8 +2,18 @@
load("http.js");
var url = argv[0];
var filename=js.startup_dir + '/' + file_getname(url);
var url = argv[0]; // First argument is the URL (required).
var outfile; // Pass a second argument as the outfile (optional).
var filename=backslash(js.startup_dir);
if (argv[1]) {
outfile = argv[1];
filename += outfile;
} else {
filename += file_getname(url);
}
print("Writing to file: " + filename);
var file = new File(filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment