Hi,
I'm a newbie to NSIS.
I want to write an installation script for my application. The files to be installed will probably change in the future. Therefore I don't want the files hardcoded in my script. Instead I try to find the files to be installed by recursively searching through a directory.
Here is part of my code:
Section "MainSection" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
${RecFindOpen} "${SOURCEDIR}" $R0 $R1
MessageBox MB_ICONINFORMATION|MB_OK "SetOutPath $INSTDIR\$R0"
SetOutPath "$INSTDIR\$R0"
${RecFindFirst}
MessageBox MB_ICONINFORMATION|MB_OK "File ${SOURCEDIR}\$R0\$R1"
File /nonfatal "${SOURCEDIR}\$R0\$R1"
${RecFindNext}
${RecFindClose}
SectionEnd
When I compile this script I get a warning for the line 'File /nonfatal "${SOURCEDIR}\$R0\$R1"': no files found. I was hoping that adding the attribute /nonfatal would lead to a compiled script that runtime is executed correctly.
However the messageboxes show the paths and filenames as expected, but nothing is installed.
Why are the commands SetOutpath and File not working when I use variables?
How can I solve this problem?
Thanks in advance for any help...
Problem parsing directory for installation of files
5 posts
You are getting confused with run time and compile time. File is a compile time instruction. RecFind is for run time.
What is wrong with File /r `${SOURCEDIR}\*.*`
Stu
What is wrong with File /r `${SOURCEDIR}\*.*`
Stu
Thanks.
File /r `${SOURCEDIR}\*.*` does the trick only partly. I have also subdirectories I want to install and there is a big change that some of the names of the directories will change.
Your solution does not solve my directory problem.
File /r `${SOURCEDIR}\*.*` does the trick only partly. I have also subdirectories I want to install and there is a big change that some of the names of the directories will change.
Your solution does not solve my directory problem.
File /r includes subdirectories as well.
Thanks!
I missed the meaning of /r! This is what I was looking for.
I missed the meaning of /r! This is what I was looking for.