Archive: Finding path to program


Finding path to program
Hi all, I tried searching, but I could not find anything, maybe I put the wrong info to search for.

I am a level designer for Raven-Shield, what I need for the installer to do is to grab the info on where the client has installed his raven-shield copy to. Like an auto find, instead of him having to use the browse button to select the location of his installation.

I love NSIS btw,it is great!


There is an instruction for reading path information from the registry (but I can't recall the instruction's name).


You usually use InstallDirRegKey for this purpose. It'll get the installation directory from a specific registry key. An example from makensis.nsi:

InstallDir $PROGRAMFILES\NSIS
InstallDirRegKey HKLM SOFTWARE\NSIS ""


You might also want to use .onVerifyInstDir to make sure the directory used is the right one. For example:

Function .onVerifyInstDir
;Check for Winamp installation

IfFileExists $INSTDIR\Winamp.exe Good
Abort
Good:
FunctionEnd

Is there ever going to be a command for doing "search all hard drives on a pc for a specific file"

That would be usful for my updates program, but right now I have to get the user to 'tell' the updater app where his downloaded files dirs are (where he commanly downloads files to) which is kinda stupid if you ask me!

-Stu


You can search a given directory using FindFirst, FindNext, and FindClose.