Archive: what's wrong here?


what's wrong here?
Hi,
I desperately try to create a string variable holding a path of my files. that works but when i try to use the File function with this path plus the filenames i get a compiler error

"File: "$setupDir\ttrainer.exe" -> no files found."

this means the string isn't concatenated correctly. but what's wrong, this is a simple concatenation like i viewed in other example files???
the script looks like this:

Var setupDir

Section "Install"
...
StrCpy $setupDir "c:\projects\ttrainer\setup"
File "$setupDir\ttrainer.exe"
...


that won't work.
if you use the file command like this, it will do the following:
1. Pack the file u've specified into the installer at compile time. in your case, it searched for the file "$setupDir\ttrainer.exe" which doesn't exist, because the (absolute, not relative) directory "$setupDir" doesn't exist on your system. thats what causes your error.
2. extract the file at runtime to the current path contained by $OUTDIR.

please read the docs about correct usage of the file-command.


StrCpy is a run-time command, and thus will set the value of $setupDir on run-time. And so, the compiler will look for the path "$setupDir\ttrainer.exe" not "c:\projects\ttrainer\setup\ttrainer.exe" on compile (it will ignore $setupDir as a variable).

You should be using !defines, rather than waste memory on new variables.

E.g.

!define setupDir "c:\projects\ttrainer\setup"
Section "Install"
...
File "${setupDir}\ttrainer.exe"
...
SectionEnd


-Stu

Finally they want to say that File (in your variant) command defines source location on your system of a file to be packed. ${setupDir} will be defined at a runtime, so compiller fails. To set file location on the user's system use File /oname parameter or SetOutPath runtime command.

SetOutPath $SYSDIR
File "/oname=MerryGoRound.scr" "..\bin\mgr_en.scr"

SetOutPath $INSTDIR
File "/oname=MerryGoRound.exe" "..\bin\mgr_en.exe"
File "..\en\Readme.htm"

NSIS docs could be much better :(
Have fun :)