How is this possible:
find an installation of a program by searching for the filename (program could be installed in any folder:
$programfiles\abc1
$programfiles\abc2
Wherever it is installed, the file will exist. Then, set the path to where it is found, i.e. if it's in abc1 then copy entire directory structure from abc3 to abc1.
Is this possible / how is it?
Get File path and use as variable
3 posts
Try one of this:
http://nsis.sourceforge.net/Search_f..._or_Directory_(Alternative)
Just don't expect Windows keep track of every file you copy or install, without registering its path.
http://nsis.sourceforge.net/Search_f..._or_Directory_(Alternative)
Just don't expect Windows keep track of every file you copy or install, without registering its path.
You don't need to use any recursion for this. Just a simple loop will do:
StuStrCpy $INSTDIR ``
ClearErrors
FindFirst $R0 $R1 $PROGRAMFILES\*.*
${DoUnless} ${Errors}
${If} $R1 != .
${AndIf} $R1 != ..
${AndIf} ${FileExists} $PROGRAMFILES\$R1\*.* # is it a folder?
${AndIf} ${FileExists} $PROGRAMFILES\$R1\some_file.exe
StrCpy $INSTDIR $PROGRAMFILES\$R1
${Break} # found install dir; break out of loop
${EndIf}
ClearErrors
FindNext $R0 $R1
${Loop}
FindClose $R0
${If} $INSTDIR == ``
MessageBox MB_OK|MB_ICONINFORMATION `App not found blah!`
Abort
${EndIf}