Old 4th January 2009, 21:04   #1
eliteeservices
Junior Member
 
Join Date: Dec 2008
Posts: 1
Send a message via ICQ to eliteeservices Send a message via AIM to eliteeservices Send a message via Yahoo to eliteeservices
Get File path and use as variable

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?
eliteeservices is offline   Reply With Quote
Old 4th January 2009, 21:13   #2
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
Try one of this:
http://nsis.sourceforge.net/Search_f..._or_Directory_(Alternative)
http://nsis.sourceforge.net/Search_For_a_File
http://nsis.sourceforge.net/Locate_plugin

Just don't expect Windows keep track of every file you copy or install, without registering its path.


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Old 4th January 2009, 22:52   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You don't need to use any recursion for this. Just a simple loop will do:

code:
StrCpy $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}



Stu
Afrow UK is offline   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