I'm using Network Security Services for Java (JSS) by Mozilla in my applet in order to allow some low-level interaction between my (signed) Java Applet and Mozilla Firefox.
One of the first problem I'm facing is how to find the current Firefox profile path. I need it because I have to call the initialize(String configDir) method of CryptoManager, and the so-called configDir has to be the directory of a Firefox profile.
How can I grab the full path of the current Firefox profile? Is there a clean way or I have to go reading profiles.ini in {$APPDATA}/Firefox, parse it and then choose a random profile (hoping it's only one, or the one I get is the correct one)?
Thanks in advance
The file location is "%APPDATA%\Mozilla\Firefox\Profiles". Simply copy that, throw it on a flash drive, and then move it to the same location on the new machine.
In Linux the main Firefox profile folder that stores personal data is in the hidden "~/. mozilla/firefox/" folder. The secondary location in "~/. cache/mozilla/firefox/" is used for the disk cache and isn't important.
Firefox saves your personal information such as bookmarks, passwords and user preferences in a set of files called your profile, which is stored in a separate location from the Firefox program files. You can have multiple Firefox profiles, each containing a separate set of user information.
In Javascript you can obtain 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
You could try looking at section 1.3.2 here:
http://kb.mozillazine.org/Profile_folder_-_Firefox#Using_the_JavaScript_or_Error_Console
Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With