We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

Fulgan
Posts: 101
Joined: Mon Feb 27, 2012 10:42 am

Finding out previous installation location, falling back to default if not found

Hello,

I'm trying to implement the following logic for finding out what path should be used as a default installation location:
- Read a registry value and use the content if it exists.
- Check if a specific folder exists on disk (maybe even check if a specific file exists in that folder). Use that path (the folder's not the file's) if it exists.
- If neither of the two condition above is met, use the default.

The reason for this cascade is that our product has been distributed for a long time using another installer and I am tasked to rewrite it. Historically, the installation could have been made in several way and I need to support the most common scenarii.

Thank you.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Finding out previous installation location, falling back to default if not found

Hello,

To achieve what you want you can use our "Search" support. You can define a search to read the registry value (REG_SEARCH_PROP) and a file search (FILE_SEARCH_PROP). Then you can use a custom action to get the parent folder path and save it in the "APPDIR" property (installation folder).

Also, you should set the default installation path in "Install Parameters" page -> "Application Folder" field (this corresponds to the "APPDIR" property). Then, you should set the "APPDIR" property with the "REG_SEARCH_PROP" property value in case the reg search succeeds or with the parent folder of the searched file in case the file search succeeds.

For instance, you can add the "GetFolderPath" custom action just after "Searches" action group and use the following condition for it:

Code: Select all

FILE_SEARCH_PROP
Then right after the above custom action add a "Set installer property" custom action liek this:
  • Property: APPDIR
    Value: [REG_SEARCH_PROP]
    Condition: REG_SEARCH_PROP
If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”