How to get the current Firefox profile path from my applet?

I use Mozilla's Java Network Security Services (JSS) in my applet to allow some low-level interaction between my (signed) Java Applet and Mozilla Firefox.

One of the first issues I am facing is finding the current path to the Firefox profile. I need this because I have to call the CryptoManager initialize (String configDir) method, and the so-called configDir should be the Firefox Profile directory.

How can I capture the full path to the current Firefox profile? Is there a clean way, or do I need to read .ini profiles in {$ APPDATA} / Firefox, analyze it, and then choose an arbitrary profile (hoping that there is only one, or the one that I get is correct)?

Thanks in advance

+8
java firefox applet
source share
2 answers

In Javascript you can get the profile and executable directory:

netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); var profile = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("ProfD", Components.interfaces.nsIFile).path var CurProcD = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("CurProcD", Components.interfaces.nsIFile).path 
+5
source share
+1
source share

All Articles