Hello Alexander,
Your scenario could be implemented with a
"Permanent" registry value that should store the APPDIR value. A search operation should be configured to get this value from registry. The permanent value will not be removed at uninstall and the search operation will retrieve it from the registry.
This is the complete method:
1. go to "Registry" page and create a new String (REG_SZ) registry value named, for example, "Location". In the Data field enter "[APPDIR]" formatted reference
2. go to the component associated with this registry value (select the value in "Registry" page and press F8 key) and set the "Permanent" attribute for it.
3. Go to "Search" page and create a new search. Right click on it and select "Add search location" - "Registry: Configure the search location to find the value from point 1. The type should be configured to "Retrieve the raw value". The result property associated with this search will contain the path of the previous installation of the same product.
Best regards,
Sorin