NSIS - The / x file does not exclude files / directories as stated

I have a directory structure that needs to be added to the installer. I have 3 different versions of my script installation, and one of them is updating the script, it requires the exclusion of a specific file and subdirectory in my installation 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 update), and therefore I do not want to overwrite them. However, when I run the installer, I clearly see that both files are overwritten, and, in addition, viewing the generated setup.exe file with 7zip shows that they are also added. You can just call

 File /r ${InputDir}\*.* 

So what is going on here? I wish NSIS would get better documentation or retype their command parameters / syntax. (/ Bombastic)

+7
source share
6 answers

NSIS Manual ( http://nsis.sourceforge.net/Docs/Chapter4.html ) section 4.9.1.5 The file contains the following:

Use / x to exclude files or directories.

I tried to use different options, but only one worked:

 SetOutPath $INSTDIR File /r /x Config ..\MyProgram\*.* 

where "Config" is the directory "MyProgram \ Plugins \ Config". NSIS only searches by name, and it will not install any subfolders correctly (for example, "/ x Plugins \ Config" or "/ x $ INSTDIR \ MyProgram \ Plugins \ Config \"). There is one drawback: if you have the same folders in different directories, they will search for the corresponding directories and files with the / r switch.

+5
source

I find that

 File /x "${DIRECTORY}Foo.img" "${DIRECTORY}*.img" 

DOES NOT exclude Foo.img at compile time - it is included in other .img files.

+3
source

I think the problem is that you should not specify the full path to the files to exclude only the template, so, in other words, the command should look like this:

 File /r /x data\someFile.xml /x data\derbydb\runtime\*.* ${InputDir}\*.* 
+1
source

/x designed to exclude certain files that will be included in the setup program at compile time.

If I understand correctly, you want to avoid overwriting files during installation / updating at runtime.

Thus, you can use the SetOverwrite flag for the compiler before the File directive. Take a look at the 4.8.2.8 SetOverwrite section of the manual, section 4.8.2 also shows the method for handling SetOverwrite dynamically.

+1
source
 var pname !define pname "Salt v1.2.9.3c" File /r /x small-games.info.url "E:\Games\${pname}\*.*" 

include E: \ Games \ $ {pname} *. * but exclude small-games.info.url in folders

+1
source

It seems to me that there is an error, which is that if:

 File /r "C:\folder a\subfolder b" File /r /x "subfolder b" "C:\folder b" 

then C:\folder b\subfolder a\subfolder b will still be copied as part of the first operation.

+1
source

All Articles