Created
March 22, 2013 21:39
-
-
Save uggrock/5224979 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.promptDirectorySelector = function promptDirectorySelector(worker) { | |
| console.debug("Opening directory selection dialog..."); | |
| try { | |
| var window = require("window/utils").getMostRecentBrowserWindow(); | |
| var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); | |
| fp.init(window, "Directory Selection", Ci.nsIFilePicker.modeGetFolder); | |
| var result = fp.show(); | |
| if (result === Ci.nsIFilePicker.returnOK) { | |
| worker.postMessage({ | |
| "command": "selectDirectory", | |
| "success": true, | |
| "content": fp.file.path | |
| }); | |
| } | |
| } catch(ex) { | |
| worker.postMessage({ | |
| "command": "selectDirectory", | |
| "success": false | |
| }); | |
| console.error("Directory selection failed "+ex); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment