mabian
14th October 2010 16:49 UTC
Calling same function during install and uninstall
Hello,
I know about the "un." limitation for uninstall function calls, but I wonder if there's some way to call the very same function during install and uninstall.
In particular, my function checks for the existence of a service; if exists, it stops it and removes it, so that:
- When installing, the updated service can be installed
- When uninstalling, the service can be removed
I'd like to reuse the same code portion and avoid macros (it's about thirty lines code using labels).
Is there some way to do this?
Thanks,
Mario
Afrow UK
14th October 2010 16:56 UTC
First link on Google search if you search for your topic subject + NSIS:
http://nsis.sourceforge.net/Sharing_...nd_Uninstaller
Please do a search in future.
Stu
mabian
14th October 2010 16:58 UTC
Thank you, I already found it; but with this technique, the code is actually doubled in the installer - so double room taken.
I was looking for a smarter solution... :)
- Mario
redxii
14th October 2010 18:24 UTC
You can't call a function in the installer from the uninstaller and vice versa, they are separate files.
So you have to use that macro technique to make it easier to maintain one piece of code for both or copy and paste the function adding "un." in front of the function name for the uninstaller.
mabian
14th October 2010 18:26 UTC
Aaahhh now I get it, thanks!
I used the "double macro" approach, works great.
This forum rocks ;)
- Mario