|
|
|
|
#1 |
|
Junior Member
Join Date: Jan 2011
Posts: 6
|
A question regarding File command
I tried to use File command as,
File /nofatal $1 NSIS couldn't find $1 but if I print out $1, I check the file does exist. If I use File as, File /nofatal "C:\temp\test.txt" (assume $1="C:\temp\test.txt"), then it works. What is wrong with File /nofatal $1? Thanks. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Mar 2006
Location: Dallas
Posts: 462
|
The FILE command is used during the compile time to compress the files into the setup program. $1 does not have a value during compile time, so the file you want to point to later cannot be put into the setup program.
During execution, FILE $1 would try to extract the file named by "$1" to the current working directory; unfortunately it will fail because the compile time function won't have worked. |
|
|
|
|
|
#3 | |
|
Junior Member
Join Date: Jan 2011
Posts: 6
|
Quote:
|
|
|
|
|
|
|
#4 | |
|
Junior Member
Join Date: Jan 2011
Posts: 6
|
Quote:
|
|
|
|
|
|
|
#5 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
Use the /oname= (out name) switch.
Stu |
|
|
|
|
|
#6 |
|
Junior Member
Join Date: Jan 2011
Posts: 6
|
Could you explain what could be done by using /oname that could NOT be done by using /nofatal? Basically, my trouble is that the file after the command File doesn't exist in compile time. So File command always complains file not found. I wonder if there is any way to execute File command or similar command in run time since the output file can only be determined in run time. Thanks.
|
|
|
|
|
|
#7 | |
|
Major Dude
Join Date: Oct 2006
Posts: 1,892
|
Quote:
What you probably want is this: ${If} (some condition here) File Yourfile.ext ${EndIf} The above will always compile Yourfile into the installer, but it will only be extracted (at runtime) if the condition is met. Or if your problem is that you want to include files dynamically (to make different installers depending on what files you have on your compiling PC), you'll probably have to use this: File YourDynamicFolder\*.* |
|
|
|
|
|
|
#8 | |
|
Junior Member
Join Date: Jan 2011
Posts: 6
|
Quote:
|
|
|
|
|
|
|
#9 |
|
Moderator
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
|
You need to think to yourself how you would go about generating these files? What will the files contain? To write to a file at run time, use FileOpen, FileWrite and FileClose.
Stu |
|
|
|
|
|
#10 |
|
Junior Member
Join Date: Jan 2011
Posts: 6
|
I resolved the problems. Thanks for you guys' suggestions. Is there any way to give you guys credits? :-)
|
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|