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.
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 value
HKEY_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.