- NSIS Discussion
- Doubts about file extraction
Archive: Doubts about file extraction
AlexVK
14th October 2009 21:23 UTC
Doubts about file extraction
Hi there,
I have this problem here: I ask the user to specify the location of two files which I must copy into the INSTDIR, the thing is that the path of both files is stored in two variables. At compile time, the File instruction always complains that it cannot find those files (for obvious reasons), so I used the /nonfatal flag, to let me go through. Let me show you:
File/nonfatal "$Path_funciondll\funcion.dll"
>File /nonfatal "$Path_compilerexe\compiler.exe"
I wonder if there is a way to tell the compiler that the path would be resolved at run time...in any case, I only extract the files at the end, so the variables will have values for granted...I do check
Thanks
Regards,
Alex
{_trueparuex^}
14th October 2009 22:06 UTC
Use the /oname switch.
File /oname=$Path_funciondllfuncion.dll somefile.dll
File /oname=$Path_compilerexecompiler.exe somefile.exe
PaR
AlexVK
15th October 2009 10:06 UTC
Thanks for the response trueparuex,
I tried the /oname option but that does not seem to work either. I dont need to change the output name, actually what I need is a variable for the "input" name, so this:
File/oname "$Path_funciondll\funcion.dll funcion.dll"
>File /oname "$Path_compilerexe\compiler.exe compiler.exe"
Does not work because the variability is in the input not in the output...What I really need is something like this:
File $Path_funciondllfuncion.dll
>
The path of the file is something that is contained in a variable, so at compile time does not contain value and thus it complains it cannot resolve the path. The /nonfatal option does not seem to work either, it will not copy the files
Regards,
Alex
{_trueparuex^}
15th October 2009 11:27 UTC
You can only set the output name at run time, everything else in File command is compile time only. File command adds the files inside the installer binary at compile time. Obviously you cannot add files to the installer at run time.
I'm not sure what you are trying to do, but it seems that CopyFiles command is what you really need. :)
PaR
AlexVK
15th October 2009 12:12 UTC
Hi again,
Basically, I have a custom page where the user introduces two paths for to specific files that I must copy to the Instalation folder, thus, I need to copy those files, no matter using File or CopyFiles. I'll have a look at that command and let you know.
Thanks!
AlexVK
15th October 2009 19:20 UTC
Hi again, CopyFiles seems to work, but only for multiple files, but I just want to copy a single file...does anybody know a way to achive this?
Regards,
Alex
pengyou
15th October 2009 19:58 UTC
You can use CopyFiles to copy a single file
CopyFiles "C:\Demo\readme.txt" "D:\Backup\readme.txt"
AlexVK
15th October 2009 20:02 UTC
My mistake, CopyFiles can copy SINGLE files :) Everything is working great now, thanks