I am making a software that comes bundled with a firefox extension. In my instalation script I want to prompt a user weather he wants to install the extension. But for that I need:
- A way to tell if firefox is installed or not
- A way to tell which version of firefox is installed
How would I do these two things in InnoSetup or C#? I tried manually checking the path to default firefox install dir or checking for uninstall records in registry. I think that these methods are not reliable at all.
Here is a shortened list of created keys (by Firefox 27.0.1 installation)
One of our client did not have the "Uninstall" one so we'll use another from that list. I am going to use: "firefox is installed when at least one of the following keys exists:"
I think
HKLM\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE
key isn't dependent from OS bits, so I suggest this.The recommended way is checking whether
HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox
registry key exists. There will be a subkey for each installed version. If you are paranoid, you can also check the valueHKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\<version>\Main\PathToExe
- if that file exists then Firefox is really installed and you aren't looking at a stale registry key.Note that you can only detect a Firefox installation only if the installer was actually used. You can always "install" Firefox manually, simply by unpacking the setup executable with 7zip - into any directory. Nightly builds are also available as regular zip files that are easier to unpack. This will work just fine but won't add any registry keys that will allow you to find this installation.