Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSIS - File /x doesn't exclude files/directories as claimed

Tags:

directory

nsis

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)

like image 815
Rex Avatar asked Jan 27 '12 09:01

Rex


2 Answers

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.

like image 64
Andark Avatar answered Oct 01 '22 21:10

Andark


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.

like image 22
Jack Avatar answered Oct 01 '22 23:10

Jack