question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NSIS: Uninstall via RMDir /r $INSTDIR is not safe

See original GitHub issue

The 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:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
nikkucommented, Aug 2, 2018

I could work on integrating the remove only installed files feature if you see a chance to merge the changes.

1reaction
develarcommented, Aug 2, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found