Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 16th October 2004, 13:56   #1
fotzor
Guest
 
Posts: n/a
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"
...
  Reply With Quote
Old 16th October 2004, 14:38   #2
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
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.
Comm@nder21 is offline   Reply With Quote
Old 16th October 2004, 16:31   #3
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
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.
code:
!define setupDir "c:\projects\ttrainer\setup"
Section "Install"
...
File "${setupDir}\ttrainer.exe"
...
SectionEnd



-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 16th October 2004, 17:20   #4
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,220
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
Takhir is offline   Reply With Quote
Reply
Go Back   Winamp 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