ronca
1st August 2008 23:05 UTC
Uninstall Deletes Uninstaller when invoked from Add/Remove Programs but not from...
Newbie. First NSIS script ever. Based on makensis.nsi. It was a no-brainer. Just copy makensis.nsi and modify the product name, file names, etc.
However. Something strange and I don't know how to troubleshoot this: When I invoke the Uninstaller from Add/Remove Programs (Windows XP control panel), it uninstalls EVERYTHING, including the uninstaller itself, and deletes my programs directory in C:\Program Files. This is what I expect and this is what I want!
However, if I invoke the Uninstaller from the Install program itself (you know, it smartly detects whether it is already installed and offers to either re-install or uninstall), it uninstalls everything, EXCEPt for the uninstaller! which means that my programs directory in C:\Program Files is not deleted...
Is this by design? or is this a bug?
If this is by design, what is the rational behind this difference in behavior based on how the Uninstaller was invoked?
If this is a bug (in my script), how do I troubleshoot this?
Thanks,
Ron
Comperio
3rd August 2008 06:15 UTC
I have to say, it sounds odd. One thing that comes to mind is the command to create the uninstaller is in the main installer. Could it be the uninstaller you are seeing is actually the one the installation is creating?
The other thing is the when you run the uninstaller, it copies itself to the TEMP folder and runs from there. By doing this, it should delete the original uninstaller from C:\program files.
But, if you are instead running something else to uninstall (or have use the "_?=" switch) from your installation, then that temp file copy thing may not be happening. (I assume you are just launching the uninstaller directly, but thought I'd mention it just in case.)
vc6
4th August 2008 15:27 UTC
Re: Uninstall Deletes Uninstaller when invoked from Add/Remove Programs but not from.
Originally posted by ronca
Is this by design? or is this a bug?
Ron, I checked for you the makensis.nsi example (the most recent one) and sure enough in Function
PageLeaveReinstall there is:
ExecWait '$R1 _?=$INSTDIR'
IfErrors no_remove_uninstaller
IfFileExists"$INSTDIR\makensis.exe" no_remove_uninstaller
>
So, your problem appears to be caused by the "_?=" switch as suggested by Comperio. Read the FAQ:
When I use ExecWait uninstaller.exe it doesn't wait for the uninstaller. Why?
NSIS uninstaller copies itself to the temporary directory, runs the temporary uninstaller create and then exits. This is done so it will be able to delete itself. To force the uninstaller not to do this use:
ExecWait '"$INSTDIR\uninstall.exe" _?=$INSTDIR'
Now the question that comes to mind is why did the makensis.nsi example writer choose to NOT WAIT for the uninstaller...
HTH,
Victor
KrisAster
4th August 2008 19:54 UTC
It also might be something as simple as the directory is still open while the uninstall is running. It could potentially be held open by your script, or by windows explorer navigated to that directory.