Reputation: 73
We are currently using a different randomly generated Application ID & installation directory for each new product version released. For example:
We chose to use separate IDs & installation directories for each new version to allow users to demo the new version without having to remove the previous version. If we used the same ID it would overwrite the previous version and invalidate their license.
However, for users that know they want to upgrade it is a 2 step process for them to install the new version and then find & run the uninstaller for the previous version. What we would like is to prompt the user with an option to uninstall the previous version (if found) during the installation process.
We have looked for some prebuilt option in the Install4j settings to allow this but have not found a good solution. Basically our desired workflow is as follows:
Ultimately I have 2 questions related to this:
NOTE: Our solution needs to also be cross compatible with Windows, Mac, & Linux
Thanks!
Upvotes: 2
Views: 664
Reputation: 48005
There is an "Execute previous uninstaller" action that can uninstall from any directory if the "Installation directory" property is set and the "Only if the same application ID is found" property is deselected.
To find out where previous versions with different application IDs are installed, use
ApplicationRegistry.ApplicationInfo[] applicationInfos =
ApplicationRegistry.getApplicationInfoById("<application ID of previous version>");
if (applicationInfos.length > 0) {
context.setVariable("uninstallDir",
applicationInfos[0].getInstallationDirectory().getPath());
}
in a "Run script" action. Then you can set the "Installation directory" property of the "Execute previous uninstaller" action to
${installer:uninstallDir}
and its "Condition expression" to
context.getVariable("uninstallDir") != null
Upvotes: 2