Skip to content
⌘ NSIS Forum Archive

Detect directory

6 posts

esky#

Detect directory

Hey, I was wondering how I can go about having NSIS detect a persons installation directory for certain software... i.e. automatically find a person's winamp folder...

also would be useful if you could make the installer refust to install till the person points it to the folder containing a specific file...

anyway, thanks
kichik#
The example named waplugin.nsi in your local Examples folder contains everything you've asked for. InstallDirRegKey to get the installation directory, .onVerifyInstDir to make sure the user chose the right directory and some more things related to Winamp.
esky#
i looked at the waplugin example, but it's really far more than what I'm looking for... and thus very confusing..

here's the code I have right now:

; The name of the installer
Name "deviantOne v1.3"

; The file to write
OutFile "devone13.exe"

; The default installation directory
InstallDir C:\Sierra\Steam

; The text to prompt the user to enter a directory
ComponentText "This will install deviantOne for Counter-Strike. [ DeviantOne.com ]""Choose a preset:"

; Installation types
InstType "Full"
InstType "Normal"
InstType "Minimum"
DirText "Enter your ROOT Steam directory:""NOTE: Do not install into the 'cstrike' folder."

; The stuff to install...

;... took out a whole bunch of the stuff im copying to make this brief

; eof
I wanna find a way to detect the correct InstallDir by default...

the registry key that holds the info is in HKEY_CURRENT_USER\Software\Valve\Steam and it's the string ModInstallPath with a value (for me) of c:\games\steam\steamapps\ncesky@hotmail.com\half-life

However I need to cut off the half-life part and replace it with counter-strike\cstrike

The other alternative is to use the string, in the same folder, SteamExe of value c:/games/steam/steam.exe and not allow the installer to go on till the person points to a dir containing a certain file...

Anyway I'd appreciate if someone can write some examples of how I can go about this...
Afrow UK#
See http://forums.winamp.com/showthread....hreadid=150997 for information on how to chop the path down.

Use InstallDirRegKey to store the installer dir.
This will be used to set and retrieve the key between different installations.

-Stu