Reputation: 435
I'm using Inno setup to build an application installer.
During the installation I am adding a registry key which provides a PATH where I will store common files (dlls etc.) which might be used by multiple different applications (or multiple versions of the same application!).
I am using the method suggested in this article: http://www.codeguru.com/cpp/w-p/dll/article.php/c99/Application-Specific-Paths-for-DLL-Loading.htm
The problem I have is that when the installation is complete, the user can auto-run the application. In this instance, the application cannot find the dlls in the PATH location. If I close the application and relaunch it from the explorer it works just fine.
I don't want to place the files in standard shared dll locations, they aren't all dlls, and I want better control of what dll versions my applications are using. Also, putting the files in the application installation .exe directory isn't an option either. I also don't want to add the PATH to the system environment path (even if I did, I suspect I would probably have the same problem anyway!)
Any ideas?
Upvotes: 1
Views: 791
Reputation: 435
Some background and my 'current' solution. Key I'm trying to add is:
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Microsoft\..\App Paths\{#ExeName}.exe"; ValueType: string; ValueData: "{app}"; Flags: uninsdeletekey
Root: HKLM; Subkey: "SOFTWARE\Microsoft\..\App Paths\{#ExeName}.exe"; ValueType: string; ValueName: "Path"; ValueData: "{#CommonPath}"; Flags: uninsdeletekey
In my [run] section I had:
Filename: {app}\{#ExeName}.exe; Description: {cm:LaunchProgram,{#AppName}}; Flags: nowait postinstall skipifsilent
I changed the flags to:
postinstall shellexec skipifsilent
As per Inno Setup Help using the shellexec command:
The file will be opened...the same way it would be if the user double-clicked the file in Explorer.
Along the lines of Martin's answer above, I believe it works because shellexec spawns a new process which picks up the environment changes, unlike if I launch the application as a child of the installer's process.
Upvotes: 1