Wireshark-dev: Re: [Wireshark-dev] Windows uninstaller doesn't remove translations.
From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Thu, 26 Mar 2020 09:58:12 -0700
On 3/26/20 1:01 AM, Guy Harris wrote:
> Or perhaps what needs to be done is to get rid of all of the Delete commands that refer to $INSTDIR\styles and just do
> 
> 	RMDir/r "$INSTDIR\styles"
> 
> to just completely blow away the "styles" directory?
> 
> 	https://nsis.sourceforge.io/Docs/Chapter4.html#registry
> 
> "4.9.1.9 RMDir
> 
> [/r] [/REBOOTOK] directory_name
> 
> Remove the specified directory (fully qualified path with no wildcards). Without /r, the directory will only be removed if it is completely empty. If /r is specified the directory will be removed recursively, so all directories and files in the specified directory will be removed. If /REBOOTOK is specified, any file or directory which could not be removed during the process will be removed on reboot -- if any file or directory will be removed on a reboot, the reboot flag will be set. The error flag is set if any file or directory cannot be removed.
> 
> RMDir $INSTDIR
> RMDir $INSTDIR\data
> RMDir /r /REBOOTOK $INSTDIR
> RMDir /REBOOTOK $INSTDIR\DLLs"
> 
> Or is the /r flag a new addition, and we still support versions of NSIS without it?

As far as I know, the /r flag has been around for a while, but we tend not to use it. I'm not sure why `RMDir /r /REBOOTOK $INSTDIR` is in the list of examples, since right below that is says:

"Warning: Using RMDir /r $INSTDIR in the uninstaller is not safe. Though it is unlikely, the user might select to install to the root of the Program Files folder and this command would wipe out the entire Program Files folder, including all other installed programs! The user can also put other files in the installation folder and wouldn't expect them to get deleted along with the program. Solutions are available for easily uninstalling only files which were installed by the installer."

This also applies to subdirectories, e.g. adding `RMDir /r $INSTDIR\Microsoft` would be a bad idea. Having said that, we've been recursively removing $INSTDIR\plugins and $INSTDIR\profiles since 2012 and 2013 respectively and no one's complained so far. I'm not sure why $INSTDIR\styles would be any different.