From what I've found here on the forum, this is a bit of a long shot, but I am looking for a way to read the actual name of the uninstaller exe.
I have a number of installers which add flight simulator scenery, and they can install to more than one simulator. To differentiate between different installations, I append the simulator version to the uninstaller filename. Currently to determine which simulator scenery needs to be uninstalled, I just compare the $INSTDIR with each of the installed locations from the registry. This has worked well, but now I want to be able to reuse a particular install for another simulator -- so if a customer has two different simulators, they will share the same scenery install. So just reading $INSTDIR won't show which simulator needs to be uninstalled, as they will be in the same location.
I'd like to read the name of the uninstaller, and check the suffix. Is there any way to do this?
Reading uninstaller name
4 posts
See http://nsis.sourceforge.net/Docs/Chapter4.html#varother. String parsing can be done with StrCpy, StrLen, StrCmp, and maybe a string searching function as well, probably ${GetExeName} (use !include "filefunc.nsh").
This is a bit tricky because the uninstaller has a random name in %temp%.
I can think of two ways of dealing with this:
A) If it always has a common prefix you can search $InstDir with FindFirstFile looking for Uninst*.exe (Not sure if this works in your specific case, you might have to save the uninstaller in a subdirectory under $InstDir)
B) Use something like the WriteCustomerData function from the wiki to append something to the uninstaller after WriteUninstaller. You can then read this data in the uninstaller (reading from itself).
I can think of two ways of dealing with this:
A) If it always has a common prefix you can search $InstDir with FindFirstFile looking for Uninst*.exe (Not sure if this works in your specific case, you might have to save the uninstaller in a subdirectory under $InstDir)
B) Use something like the WriteCustomerData function from the wiki to append something to the uninstaller after WriteUninstaller. You can then read this data in the uninstaller (reading from itself).
Cheers, guys.
Yes, I might end up creating a subfolder for a particular simulator, just for the uninstallers -- so I don't end up with two uninstallers for the same product in the one location, then I can continue to use $INSTDIR to pinpoint the version.
There is an alternative, which is just have a single uninstaller, and let the user choose which to uninstall. This might be preferable, to overcome some legacy installer issues.
Why is nothing simple? 🙂
Yes, I might end up creating a subfolder for a particular simulator, just for the uninstallers -- so I don't end up with two uninstallers for the same product in the one location, then I can continue to use $INSTDIR to pinpoint the version.
There is an alternative, which is just have a single uninstaller, and let the user choose which to uninstall. This might be preferable, to overcome some legacy installer issues.
Why is nothing simple? 🙂