Old 23rd June 2005, 08:56   #1
--lMarcl--
Guest
 
Posts: n/a
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
  Reply With Quote
Old 23rd June 2005, 12:49   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You can check with:
code:
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
Afrow UK is offline   Reply With Quote
Old 23rd June 2005, 17:56   #3
- -lMarcl- -
Guest
 
Posts: n/a
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:
  Reply With Quote
Old 23rd June 2005, 18:34   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Or just do:
code:

ReadRegStr $INSTDIR HKLM Software\Rockstar-Games\GTA Vice City "InstallPath"
StrCmp $INSTDIR "" 0 +2
StrCpy $INSTDIR "C:\GTA VC"



-Stu
Afrow UK is offline   Reply With Quote
Old 25th June 2005, 16:57   #5
- -lMarcl- -
Guest
 
Posts: n/a
Thank you for the reply.

But I've an other question:

The code:

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
  Reply With Quote
Old 25th June 2005, 17:44   #6
Mæster
Member
 
Join Date: Apr 2003
Location: Germany
Posts: 62
Send a message via ICQ to Mæster Send a message via AIM to Mæster
Even outside a function or section you easely could use

code:
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.
Mæster is offline   Reply With Quote
Old 25th June 2005, 20:34   #7
Sp33dy Gonzale$
Guest
 
Posts: n/a
Thank you that's it
  Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump