Archive: Using the SearchPath command ...


Using the SearchPath command ...
Hi! For sometime i'm trying to use to SearchPath command but without sucess ... I've read the NSIS manual but my english isn't that good so i can't get the syntax right ...

I'm trying to use like this:

SearchPath $(APP) app.exe

And always get an error message ...

Anyone can help me?! Thanks!


SearchPath $R0 app.exe

or

Var APP
SearchPath $APP app.exe


Hi! I'm back. Well, i did like you said. It compiled without any problem but i could not make it work ...

That's what I'm trying:

SetOutPath "$INSTDIR"
File "C:\anything.dll"
SearchPath $R0 app.exe
CopyFiles /SILENT "$INSTDIR\anything.dll" "$R0\Plugins"

But it does not copy the file ...


It will only work if app.exe is stored in one of the system directories, it does not search the whole drive.


Sorry about taking your time Joost ... But, would you know how to do this ? I mean, I'm trying to copy a file from the $INSTDIR to the plugins' directory of Winamp if the user has Winamp. So I need a way to know if the user has Winamp installed and where is it ...


See the waplugin.nsi example in your local Examples folder.


Hi kichik! I've read the waplugin.nsi file ... But i don't think that it can help me ... That's because in the example file the user that installs it have to set the WA directory with the directory page ... On my installer, the install directory has nothing to do with the Winamp directory, otherwise it would be easy. =P But I must find a way to detect the plugins' directory of Winamp to extract one file to this directory if the user has Winamp installed ... In the last case i think i'll suppose that the user has installed Winamp in $PROGRAMFILES\Winamp. So if WA isn't there, what can i do ? =P


It only gives the user the option to choose another directory, it detects the Winamp folder.

You can use two directory pages if you want.


Hi! Well, i've read the waplugin.ini file again and i put this part of it in my script:

Function GetWinampInstPath

Push $0
Push $1
Push $2
ReadRegStr $0 HKLM \
"Software\Microsoft\Windows\CurrentVersion\Uninstall\Winamp" \
"UninstallString"
StrCmp $0 "" fin

StrCpy $1 $0 1 0
StrCmp $1 '"' "" getparent

StrCpy $0 $0 "" 1
StrCpy $1 0
rqloop:
StrCpy $2 $0 1 $1
StrCmp $2 '"' rqdone
StrCmp $2 "" rqdone
IntOp $1 $1 + 1
Goto rqloop
rqdone:
StrCpy $0 $0 $1
getparent:

StrCpy $1 -1
gploop:
StrCpy $2 $0 1 $1
StrCmp $2 "" gpexit
StrCmp $2 "\" gpexit
IntOp $1 $1 - 1
Goto gploop
gpexit:
StrCpy $0 $0 $1

StrCmp $0 "" fin
IfFileExists $0\winamp.exe fin
StrCpy $0 ""
fin:
Pop $2
Pop $1
Exch $0

FunctionEnd

And has tried to use that function in this part ...

Section "" SecCopyUI

Call GetWinampInstPath

CopyFiles /SILENT "$INSTDIR\example\anything.dll" "$0\Plugins"

SectionEnd

But it didn't work ... The var $0 is read just as 0 ... =[

Any hint? Thank you again guys for helping ...


You have to get the value from the stack after calling the function:

Pop $0


Well, I'm just posting here again to thank you guys for your time since it worked now!


YYYYYYYYYEEEEEEEEEEEEEAAAAAAAAAAAAHHHHHHHHHHH!!!!!!!!!!!!!! UHHHHHHHHHUUUUUUUUUUUU!!! Someone from Brazil!!!!!!!! I'm too!!!!!!!!

(Rarely this happened before)


Hehehe! Hi deguix! A lot a people use NSIS here too. =P And as you can see, not only here, but in many parts of the world! When I saw that kichik is from Israel I thought "- Ow, I'm talking to someone in Israel. =O". Internet RULES =P ...