All entries for Friday 05 February 2010
February 05, 2010
Finding the path of a Firefox profile
The other day I found myself needing to be able to determine the path of a user's Firefox profile. It was one of those tasks that seemed very simple to start with but then got more complicated the more I thought about it. Some people have more than one Firefox profile. So it needs to be determined which one is the default, which requires working it out by looking at the user's profiles.ini file. profiles.ini may contain details of one or more profiles. If it contains details of more than one profile one of them will be marked as the default, but if there is only details of one profile it won't be marked as the default. If a profile is marked as default then the line which marks it as default isn't always in the same place in relation to the other information about the profile. The path to the profile that appears in profiles.ini might be relative to the location of profiles.ini, or it might not be. In the end I realised that rather than it being a case of writing a couple of lines in the script I was writing, it was a task best suited to being broken out in to a separate script which I can re-use in future.
Anyway, in the admittedly unlikely event that you've been looking for a way to find the path to a user's Firefox profile, here's a Script to find path of default or specified Firefox profile. It's written for Linux. It will probably work on other *nix systems (e.g. Mac OS X) by changing the value of $firefoxprofiledir and maybe making a few other tweaks.