I have a directory structure that needs to be added to the installer. I have 3 different versions of my install script, and one of them being an upgrade script, requires excluding a certain file and a subdirectory within my install directory. So I do the following:
File /r /x ${InputDir}\data\someFile.xml /x ${InputDir}\data\derbydb\runtime\*.* ${InputDir}\*.*
The xml file and the derbydb directory are already present (since this is an upgrade) and hence I don't want to overwrite them. Yet on running the installer I clearly see that both files are overwritten, and moreover viewing the generated setup.exe with 7zip shows that they got added as well. One may as well have just called
File /r ${InputDir}\*.*
So what's going wrong here? I wish NSIS would have better documentation or list caveats with their command parameters/syntax. (/rant)
NSIS manual (http://nsis.sourceforge.net/Docs/Chapter4.html) section 4.9.1.5 File contains the following:
Use the /x switch to exclude files or directories.
I tried to use different variants, but only one worked:
SetOutPath $INSTDIR
File /r /x Config ..\MyProgram\*.*
where "Config" is a directory "MyProgram\Plugins\Config". NSIS searches only by name and it will be wrong to set any subfolders (e.g. "/x Plugins\Config" or "/x $INSTDIR\MyProgram\Plugins\Config\"). There is one lack: if you have the same folders in different directories, using the /r switch, both matching directories and files will be searched.
I find that
File /x "${DIRECTORY}Foo.img" "${DIRECTORY}*.img"
does NOT exclude Foo.img at compilation time - it is included with the other .img files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With