NSIS: Uninstall via RMDir /r $INSTDIR is not safe
See original GitHub issueThe NSIS uninstaller uses RMDir /r $INSTDIR
to remove the installation directory.
As mentioned in the NSIS documentation it is not a safe command to execute. The reason is that people may accidentally install the application in the Program Files
directory and wipe the whole directory, including all installed programs, on uninstall.
Another issue is that this approach is not friendly towards app directory customization: People may add additional config files and folders local to the installation. Upon update these files are removed along with the whole installation directory.
We could improve the uninstaller to only remove installed files to improve the situation.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Reference/RMDir - NSIS Wiki
Warning : using RMDir /r $INSTDIR in the uninstaller is not safe. Though it is unlikely, the user might select to install to...
Read more >Avoiding the use of "RMDir /r @INSTDIR" - NSIS Forums
I've seen the warning about using "RMDir /r @INSTDIR" and the code sample for Uninstalling only installed files and that all make sense....
Read more >49861 – NSIS: remove the directory after the NSIS is finished
After NSIS installer is finished, the directory where it unpacked the whole tree should be removed. set target. Looks like it is on...
Read more >uninstaller.nsi - mozsearch - Searchfox
7-Zip provides better compression than the lzma from NSIS so we add the files ... RmDir /r /REBOOTOK "$INSTDIR\defaults\shortcuts". ${EndIf}.
Read more >Is it safe to do “RmDir /r $INSTDIR” in NSIS - iTecNote
installationnsis. I noticed this warning in the documentation for NSIS's RmDir method: Warning: using RMDir /r $INSTDIR in the uninstaller is not safe....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I could work on integrating the remove only installed files feature if you see a chance to merge the changes.
No, you cannot install to
Program Files
or to another such dir. Because even if you will allow to choose installation dir, you cannot select any dir. Please see https://github.com/electron-userland/electron-builder/blob/master/packages/app-builder-lib/templates/nsis/assistedInstaller.nsh#L45