Skip to content

Instantly share code, notes, and snippets.

@gialloporpora
Created February 9, 2010 23:55
Show Gist options
  • Save gialloporpora/299839 to your computer and use it in GitHub Desktop.
Save gialloporpora/299839 to your computer and use it in GitHub Desktop.
/* This command open the profile folder */
function openLocalFolder(dir){
nsLocalFile = Components.Constructor("@mozilla.org/file/local;1","nsILocalFile", "initWithPath");
new nsLocalFile(dir).reveal();
}
CmdUtils.CreateCommand({
names: ["open-profile"],
description: "Open the profile directory in your file explorer..",
help: "Type open-profile to open the profile folder.",
author: {
name: "Sandro Della Giustina",
email: "[email protected]",
homepage: "http://labs.mozilla.com/",
},
license: "GPL",
homepage: "http://ubiquity.mozilla.com/",
icon: "http://www.mozilla.com/favicon.ico",
execute: function execute() {
// Get the profile directory.
propertiesService = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
currProfD = propertiesService.get("ProfD", Ci.nsIFile);
profileDir = currProfD.path;
openLocalFolder(profileDir );
},
preview: function preview(pblock, args) {
pblock.innerHTML = "Open profile directory...";
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment