NSIS.template.in does not quote the uninstall executable, which causes the uninstallation to fail if the application is installed into a folder that contains space.
Windows has two ways of uninstalling a program:
- A. Using the classic "Programs and Features" window: this contains some heuristics that can deal with uninstalling an application, even if the uninstaller executable is not quoted.
- B. Using the modern "Apps & features" window: this literally interprets the UninstallString is
C:\Users\andra\AppData\Local\NA-MIC\Slicer 4.13.0-2021-08-16\Uninstall.exethen it tries to launch
C:\Users\andra\AppData\Local\NA-MIC\Slicerwith the argument
4.13.0-2021-08-16\Uninstall.exe, which of course fails.
According to NSIS documentation, uninstaller executable path in UninstallString must always be quoted:
UninstallString (string) - Path and filename of the uninstaller. You should always quote the path to make sure spaces in the path will not disrupt Windows to find the uninstaller. To escape quotes, use single quotes unless a variables is included, in which case an escape sequence will have to be used. The escape sequence is this: $\
This is fixed in various CMake-based applications by locally correcting the template (for example here), but this problem should be fixed in CMake instead.
This fixes this error in 3D Slicer: https://github.com/Slicer/Slicer/issues/4933