commit adadc9e03a061ab7c4be8492680a8414c5805f0b parent 31941c079871af1eeae717105e9da343c8af70d8 Author: Dan Stillman <dstillman@zotero.org> Date: Tue, 7 Apr 2015 01:15:13 -0400 Accept a string path in Zotero.Utilities.Internal.exec() Diffstat:
| M | chrome/content/zotero/xpcom/utilities_internal.js | | | 7 | ++++++- |
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js @@ -290,11 +290,16 @@ Zotero.Utilities.Internal = { /** * Launch a process - * @param {nsIFile} cmd Path to command to launch + * @param {nsIFile|String} cmd Path to command to launch * @param {String[]} args Arguments given * @return {Promise} Promise resolved to true if command succeeds, or an error otherwise */ "exec":function(cmd, args) { + if (typeof cmd == 'string') { + Components.utils.import("resource://gre/modules/FileUtils.jsm"); + cmd = new FileUtils.File(cmd); + } + if(!cmd.isExecutable()) { return Q.reject(cmd.path+" is not an executable"); }