Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the most reliable way to check for firefox installation?

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:

  1. A way to tell if firefox is installed or not
  2. 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.

like image 776
c0ldcrow Avatar asked Aug 20 '11 12:08

c0ldcrow


1 Answers

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.

like image 145
Wladimir Palant Avatar answered Oct 25 '22 15:10

Wladimir Palant