Last active
February 24, 2016 06:30
-
-
Save Noitidart/feeec1776c6ee4254a34 to your computer and use it in GitHub Desktop.
_ff-addon-snippet-showFileInOSExplorer - Opens the file or directory in operating systems file explorer, uses XPCOM.
This file contains 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
// rev3 - https://gist.github.com/Noitidart/feeec1776c6ee4254a34 | |
function showFileInOSExplorer(aNsiFile, aDirPlatPath, aFileName) { | |
// can pass in aNsiFile | |
if (aNsiFile) { | |
//http://mxr.mozilla.org/mozilla-release/source/browser/components/downloads/src/DownloadsCommon.jsm#533 | |
// opens the directory of the aNsiFile | |
if (aNsiFile.isDirectory()) { | |
aNsiFile.launch(); | |
} else { | |
aNsiFile.reveal(); | |
} | |
} else { | |
var cNsiFile = new FileUtils.File(aDirPlatPath); | |
if (!aFileName) { | |
// its a directory | |
cNsiFile.launch(); | |
} else { | |
cNsiFile.append(aFileName); | |
cNsiFile.reveal(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
README
Rev1
Rev2
Rev3