--lMarcl--
23rd June 2005 09:56 UTC
How can I found the install path of a Programm
Hy
I've build an Extension (with Multiplayer) for my game (Gta Vice City). But now I must find the Installdir of it also If it exist on the computer D:\Games\GTA VC and if it not exist C:\Games\Extension\GTA VC
How can I do this ?
Thank you
Afrow UK
23rd June 2005 13:49 UTC
You can check with:
IfFileExists "D:\Games\GTA VC\*.*" 0 +3
StrCpy $INSTDIR "D:\Games\GTA VC"
Goto done
IfFileExists "C:\Games\Extension\GTA VC\*.*" 0 +2
StrCpy $INSTDIR "C:\Games\Extension\GTA VC"
done:
However, this isn't a very good way to go about it. The user may have installed to Program Files ($PROGRAMFILES) or maybe even E:\
Your best bet is to look for a registry entry which contains the game's path by using ReadRegStr.
-Stu
- -lMarcl- -
23rd June 2005 18:56 UTC
Thank you for answer me. Yes there is an RegStr is it right so ?
ReadRegStr $0 HKLM Software\Rockstar-Games\GTA Vice City "InstallPath"
StrCpy $0 $INSTDIR ""
done:
Afrow UK
23rd June 2005 19:34 UTC
Or just do:
ReadRegStr $INSTDIR HKLM Software\Rockstar-Games\GTA Vice City "InstallPath"
StrCmp $INSTDIR "" 0 +2
StrCpy $INSTDIR "C:\GTA VC"
-Stu
- -lMarcl- -
25th June 2005 17:57 UTC
Thank you for the reply.
But I've an other question:
The code:
ReadRegStr $0 HKLM Software\Rockstar-Games\GTA Vice City "InstallPath"
StrCpy $0 $INSTDIR ""
done:
must be in a Function ?
Example: Function Path
And on the top I write call Path.
But there is an Error because I can't exec the Installer.
Thx Marc
Mæster
25th June 2005 18:44 UTC
Even outside a function or section you easely could use
InstallDir "C:\GTA Vice City"
InstallDirRegKey HKLM Software\Rockstar-Games\GTA Vice City "InstallPath"
Thats all you need. If a valid registry string was found the new InstallDir is set otherwise it falls back to the previous value.
Sp33dy Gonzale$
25th June 2005 21:34 UTC
Thank you that's it