coco_vc
31st March 2006 15:09 UTC
Uninstall section - removing files
Hi *,
I used some wizards to generate a basic installer that just copies 3 files on the destination computer. I noticed that in the uninstall section is:
Delete "$INSTDIR\sample1.exe"
Delete "$INSTDIR\sample2.exe"
Delete "$INSTDIR\sample3.exe"
Why would I need something like this (3 times the Delete command) and not having in the uninstall section just:
RMDir /REBOOTOK "$INSTDIR"
Otherwise if I have 20 files that I need to copy when install, and to remove when uninstall, I would need 20 times the File command and 20 times the Delete command, for the same files, instead of 1 RMDir only in uninstall case. Or am I totally wrong/missing smth here?
Thanks,
Viv
bhaelochon
31st March 2006 15:46 UTC
RMDir /r /REBOOTOK $INSTIDR
rsegal
31st March 2006 15:57 UTC
Re: Uninstall section - removing files
Originally posted by coco_vc
Otherwise if I have 20 files that I need to copy when install, and to remove when uninstall, I would need 20 times the File command and 20 times the Delete command, for the same files, instead of 1 RMDir only in uninstall case. Or am I totally wrong/missing smth here?
Thanks,
Viv
You could do either way but you may want to consider where people are installing these files/folders from your install package. If someone installs their files to their My Documents folder and you tell the uninstaller to delete the entire folder that user has just had their My Documents folder deleted. Don't laugh. It's happened to me. Most users are likely to install files to a unique folder name that will not conflict with any other files/folders on their computer and you are likely to have a pre populated folder name for where your files are to be installed.
Alternatively as has been mentioned many times on these forums you can keep track of what files are installed during installation and then uninstall only those files by reading that file. This has the nice advantage that you can install to potentially dangerous spots such as My Documents or even the Windows\System folder and uninstall and you'll have no issues on uninstallation.
dienjd
31st March 2006 17:38 UTC
Agreed, using "RMDir /r $INSTDIR" is irresponsible unless you know what $INSTDIR is. People do odd things when installing, and nobody wants to be responsible for wiping a user's $WINDIR, $PROGRAMFILES, $APPDATA, etc. when they uninstall.
coco_vc
3rd April 2006 12:51 UTC
Thx for all your answers. So your suggestion would be to:
- delete specifically each file I installed
- delete, maybe over reboot, the INSTDIR, without using the /r flag
So, it will look like:
Delete /REBOOTOK "$INSTDIR\sample1.exe"
Delete /REBOOTOK "$INSTDIR\sample2.exe"
Delete /REBOOTOK "$INSTDIR\sample3.exe"
RMDir /REBOOTOK "$INSTDIR"
This would be both: save and nice.
Questions:
1) Is the above correct?
2) Is there a way to specify only once all the files that need to be installed and removed (it's the same list, so would be nice to have somehow a list of all files and on install specify to install all and on uninstall to remove all)
Thx,
Viv
Afrow UK
3rd April 2006 15:41 UTC
To delete only installed files, use:
http://nsis.sourceforge.net/Uninstal...nstalled_files
This is probably not needed here though; you might as well just delete them yourself with the code that you have posted (which is perfect).
-Stu
coco_vc
3rd April 2006 16:18 UTC
Thx Stu. I used in the end the:
Delete /REBOOTOK "$INSTDIR\sample1.exe"
Delete /REBOOTOK "$INSTDIR\sample2.exe"
Delete /REBOOTOK "$INSTDIR\sample3.exe"
RMDir /REBOOTOK "$INSTDIR"
Viv