Rob Hunter
Rob Hunter

Reputation: 2837

How can I find the installation folder after the installation is complete?

I am trying to write an extension installer, but have to locate the prerequisite application's INSTALLDIR. The prerequisite application is installed with MSI. The extension installer is using Inno Setup.

Any hints on where I can get this information from?

I have looked into the Windows uninstall registry, but the InstallLocation value is blank.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{MY-PRODUCTID-GUID-HERE}]
"Comments"=""
"Contact"=""
"DisplayVersion"="1.0.0"
"HelpLink"=""
"HelpTelephone"=""
"InstallDate"="20111021"
"InstallLocation"=""
"InstallSource"="D:\\Documents\\Downloads\\"
"URLUpdateInfo"=""
"VersionMajor"=dword:00000001
"VersionMinor"=dword:00000000
"WindowsInstaller"=dword:00000001
"Version"=dword:01000000
"Language"=dword:00000409
"DisplayName"="MyApp (64-bit)"

Upvotes: 2

Views: 1153

Answers (4)

Alexey Ivanov
Alexey Ivanov

Reputation: 11838

Install applications are not required to write InstallLocation to Uninstall registry key, however it's recommended. Yet you have to take care of it yourself when developing installation package.

The program could have written this value into its own key in the registry, for example: HKLM\Software\MyApp.

If prerequisite is yours, then modify the installer so that it writes the directory where extensions should be installed into the registry, as suggested by Bob.

Upvotes: 0

Bob Arnson
Bob Arnson

Reputation: 21886

MSI doesn't restrict a package to having a single installation directory, so there's no way to query for one. If you want to offer extensibility like that, pick a directory and write it to the registry for others to query.

Upvotes: 2

Deanna
Deanna

Reputation: 24273

If it's not in that location, you could ask the authors of the main package to see if they store the path anywhere. If not, DevinBM's suggestion is the only practical way.

Upvotes: 0

DevinBM
DevinBM

Reputation: 91

The easy way out of this problem is to attempt to navigate to the default install directory of the prerequisite. If it can't be found, prompt the user for the path to the install directory.

I use NSIS. so, in those terms it goes something like this:

    Function .onInit

  Pop $R1 ; "c:\\Program Files\ etc...."

  # Check if it is installed
  StrCmp $R1
    MessageBox MB_OK|MB_ICONSTOP $(NotInstalled)
    Abort

  # It is installed so set INSTDIR
  StrCpy $INSTDIR "$R1"

FunctionEnd

Upvotes: 2

Related Questions