tannayr
8th May 2008 14:03 UTC
Ability to uninstall post install added files
To clarify, my program has a built in updater that updates and adds files as they are needed. I used HM NSIS Edit wizard to make my installer/uninstaller and it worked beautifully. Except any files that were downloaded/updated after the install were not deleted and because of this left the folders and the start menu items in place.
What I am asking is how to obtain the functionality to remove files and folders added to the directory after an install. If anyone could point me in the right direction I would greatly appreciate it. Thanks.
DEbln001
8th May 2008 14:58 UTC
I also used downloads in my installer.
If wanted (checkbox) my installer deletes files after execution. I use the following command:
IfFileExists "$TEMP\FILE_xyz.exe" 0 +2
Delete "$TEMP\FILE_xyz.exe"
I hope that helped you a bit
mrmagik
8th May 2008 15:01 UTC
Just put your delete commands in a post install section, usually:
Section -post SECPostInstall
; Remove the temp Installation Directory
RmDir /REBOOTOK $TEMP\myInstall
SectionEnd
Or whatever is appropriate for your installer.
tannayr
8th May 2008 15:05 UTC
Thanks for the quick replies. Going to implement this within the next few hours. Assuming I can change $temp to whatever i need as they are not temporary files.
mrmagik
8th May 2008 15:09 UTC
$TEMP is the Windows temporary directory. It is a built-in/pre-defined variable. You could specify any path for the RmDir command, however. I was just showing you an example.
Anyway, I recommend using EclipseNSIS, the auto-complete and documentation tree that runs alongside it is invaluable IMO.
tannayr
8th May 2008 18:31 UTC
Think I was a bit unclear with my request. I don't want them deleted after the install. Say if the customer uses the product for a year, and it updates itelf within that year. How do I make the uninstaller delete any files within the directory without having it prespecified in "section UNINSTALL". Is it possible to add just a "Delete "$INSTDIR\*" kind of thing where * = anything and everything in the $INSTDIR.
fabian.rap.more
8th May 2008 19:49 UTC
Yes
AaronLS
8th May 2008 23:35 UTC
If you look at the makensis.nsi in Examples they do use RMDir /r to remove a directory and all it's subfiles and subdirectories. They do this for each of the known directories within INSTDIR, but you'll notice they do NOT do a
RMDir /r $INSTDIR
I think the reason is that if someone change the destination from soemthing like "C:\Programs Files\NSIS\" to "C:\Program Files\", then you would NOT want to do a RMDir /r $INSTDIR because it'd blow away their entire Program Files directory.
So if you don't add any new directories to the root of INSTDIR, and updates only add files(or directories that are more than one level deep) then you could do something like the NSIS isntaller:
RMDir /r $INSTDIR\Bin
RMDir /r $INSTDIR\Updates
RMDir /r $INSTDIR\Docs
RMDir /r $INSTDIR\Examples
RMDir $INSTDIR
;I believe this last command will only remove
;INSTDIR if it is empty, since there is no /r
tannayr
9th May 2008 03:53 UTC
Thanks Aaron.
Red Wine
9th May 2008 05:13 UTC
There's the easy way too,
Advanced Uninstall Log