krisbg
7th March 2005 18:50 UTC
Return code of uninstaller
Hi!
I want to understand when my installer has found a previous version and has run it's uninstaller, if the user hit the Cancel button in the uninstaller so the current installer to be stopped too. Is there a way to find if the user hit Cancel from the return value?
pengyou
7th March 2005 19:13 UTC
From the NSIS Users Manual (Appendix D - Useful Information):
Error levels:
Like other applications installers made by NSIS return error levels as a result of their execution. Checking the error level can be useful if you call an NSIS installer from another application or installer.
0 - Normal execution (no error)
1 - Installation aborted by user (cancel button)
2 - Installation aborted by script
To find out how to access the uninstaller's error level, read the rest of this section of the manual:
http://nsis.sourceforge.net/Docs/AppendixD.html#D.2
krisbg
8th March 2005 11:45 UTC
Thank You!
It's interesting that in the manual is written that the uninstaller copies itself into the $TEMP folder and executes from there so to be able to get the correct return code you should copy it there manually. But I experimented and saw that even if I don't copy it by myself I still get the correct codes. Does anybody know something about this?
kichik
8th March 2005 19:22 UTC
As of NSIS 2.01, you can set the error level to other values using SetErrorLevel.
If you execute the uninstaller with _?= it will not copy itself and you'll get the real return value.