this._lastRunCommand = ""; // updated whenever the users runs a command with :!
this._scriptNames = [];
-
- this.downloadListener = {
- onDownloadStateChange: function (state, download) {
- if (download.state == services.downloadManager.DOWNLOAD_FINISHED) {
- let url = download.source.spec;
- let title = download.displayName;
- let file = download.targetFile.path;
- let size = download.size;
-
- dactyl.echomsg({ domains: [util.getHost(url)], message: _("io.downloadFinished", title, file) },
- 1, modules.commandline.ACTIVE_WINDOW);
- modules.autocommands.trigger("DownloadPost", { url: url, title: title, file: file, size: size });
- }
- },
- onStateChange: function () {},
- onProgressChange: function () {},
- onSecurityChange: function () {}
- };
-
- services.downloadManager.addListener(this.downloadListener);
},
CommandFileMode: Class("CommandFileMode", modules.CommandMode, {
}
}),
- destroy: function destroy() {
- services.downloadManager.removeListener(this.downloadListener);
- },
-
/**
* Returns all directories named *name* in 'runtimepath'.
*
*
* @returns {File}
*/
- createTempFile: function createTempFile(name) {
- if (name instanceof Ci.nsIFile)
+ createTempFile: function createTempFile(name, type) {
+ if (name instanceof Ci.nsIFile) {
var file = name.clone();
+ if (!type || type == "file")
+ file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
+ else
+ file.createUnique(Ci.nsIFile.DIRECTORY_TYPE, octal(777));
+ }
else {
file = services.directory.get("TmpD", Ci.nsIFile);
file.append(this.config.tempFile + (name ? "." + name : ""));
+ file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(666));
}
- file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(600));
services.externalApp.deleteTemporaryFileOnExit(file);
if (bin instanceof File || File.isAbsolutePath(bin))
return this.File(bin);
- let dirs = services.environment.get("PATH").split(config.OS.isWindows ? ";" : ":");
+ let dirs = services.environment.get("PATH")
+ .split(config.OS.pathListSep);
// Windows tries the CWD first TODO: desirable?
if (config.OS.isWindows)
dirs = [io.cwd].concat(dirs);
// TODO: when https://bugzilla.mozilla.org/show_bug.cgi?id=68702 is
// fixed use that instead of a tmpfile
/**
- * Runs *command* in a subshell and returns the output in a string. The
- * shell used is that specified by the 'shell' option.
+ * Runs *command* in a subshell and returns the output. The shell used is
+ * that specified by the 'shell' option.
*
- * @param {string} command The command to run.
+ * @param {string|[string]} command The command to run. This can be a shell
+ * command string or an array of strings (a command and arguments)
+ * which will be escaped and concatenated.
* @param {string} input Any input to be provided to the command on stdin.
* @param {function(object)} callback A callback to be called when
* the command completes. @optional
* otherwise, the return value of *func*.
*/
withTempFiles: function withTempFiles(func, self, checked, ext) {
- let args = array(util.range(0, func.length)).map(bind("createTempFile", this, ext)).array;
+ let args = array(util.range(0, func.length))
+ .map(bind("createTempFile", this, ext)).array;
try {
if (!args.every(util.identity))
return false;