Baafen
23rd August 2006 12:29 UTC
Uninstall only installed files
Hello!
Im new to NSIS but i have made som installers.
But now im trying to make so only the installed files gets uninstalled. I found this
But then my uninstallers uninstalls I stops then i trys to delete the folder. For example: then the uninstaller trys to uninstall INSTDIR\direxample the uninstallers stop and does nothing.
whats wrong with the code? If I skip to install that section that dosent work an other one makes it stop :(
Here is the code for one section that dont work:
Section "FGDs" SEC02
${AddItem} "$INSTDIR\fgd"
${SetOutPath} "$INSTDIR\fgd\counter-strike"
${File} "C:\Documents and Settings\Jocke\Skrivbord\Baafens mapp\instaler\Mapping\instalfiler\FGD\fgd\counter-strike\" "cs_expert-tom793c.fgd"
${File} "C:\Documents and Settings\Jocke\Skrivbord\Baafens mapp\instaler\Mapping\instalfiler\FGD\fgd\counter-strike\" "halflife-cs_expert.fgd"
${SetOutPath} "$INSTDIR"
${File} "C:\Documents and Settings\Jocke\Skrivbord\Baafens mapp\instaler\Mapping\instalfiler\" "Readme Baafen VHETOOLS Pack.txt"
SectionEnd
Baafen
23rd August 2006 15:55 UTC
Sorry for dubble post but I cant edit anymore..
Well I have only one thing left.
The uninstaller dosent delete the uninstall.log thats why my uninstaller freeze.
This part is that will delete the uninstall.log but i dont
FileClose $UninstLog
Delete "$INSTDIR\${UninstLog}"
Pop $R2
Pop $R1
Pop $R0
Comperio
23rd August 2006 16:47 UTC
It's a bit odd, but here's a couple things you might look at:
1. $INSTDIR during uninstall is the directory in which the Uninstaller is located, which means that it's NOT necessarily what $INSTIDR was set to during the install. So it could be that you are not even in the right directory (or at least not in the directory you think you are.)
2. The uninstaller by default copies itself to the TEMP folder and runs from there, which would also mean that $INSTDIR could be pointed to your temp directory and not where you intended.
My recommendation would be that during install, you write $INSTDIR either to the registry or save it to a known file location. Then, during uninstall read the value back to you know exactly where to look.
You can also specify $INSTDIR during uninstall by using the _? switch. Refer to the section 3.2.2 of the help files for more info.
Baafen
23rd August 2006 16:58 UTC
_?= sets $INSTDIR. It also stops the uninstaller from copying itself to the temporary directory and running from there. It can be used along with ExecWait to wait for the uninstaller to finish. It must be the last parameter used in the command line and must not contain any quotes, even if the path contains spaces.
But the user who installs the files can choose were to install. So if I sett the $INSTDIR to C:Program/name and if the user installs the program at C:name. What will happen then?
My recommendation would be that during install, you write $INSTDIR either to the registry or save it to a known file location. Then, during uninstall read the value back to you know exactly where to look.
Like I said Im kind of new to NSIS so how can I make this
work?
I think I know what the problem is now. I think the prolem is that uninstall.log is still in use. Then I try to delete it my computer says that uninstall.log is in use.
So FileClose $UninstLog dosent do what i should do..
I hope someone can answear how to solve this.