Warrigal
Posts: 43
Joined: Thu Jun 26, 2008 8:20 am

How to find a file relative to INSTALLDIR

I need to do the following:
1. Do a registry search to set INSTALLDIR. This works fine and I've been using it for years.
2. Do a file search for a file in a path relative to INSTALLDIR. This is new and I can't get it to work.

What's the correct way to do this file search? If I search all drives, it works. If I search for a file using an absolute path, it works. But I need to use the path relative to INSTALLDIR and this doesn't work. I suspect that the search for the registry entry is being done after the search for the file, hence the file cannot be found. But that's just a hunch. Any ideas?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to find a file relative to INSTALLDIR

Hello,

I am afraid Windows Installer does not support searches based on the properties created by other searches. In other words, you can not create a search based on another search.
For implementing this functionality, you will unfortunately have to create your own custom action to do this for you.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
Warrigal
Posts: 43
Joined: Thu Jun 26, 2008 8:20 am

Re: How to find a file relative to INSTALLDIR

I am afraid Windows Installer does not support searches based on the properties created by other searches. In other words, you can not create a search based on another search.
In fact, you can. Define a search for a folder. The result is stored in a property. This will be null if the folder wasn't found.

Now define a search for a file in the folder defined by the property name. The result is stored in another property. Works like a charm. The only trap is to make sure that the folder search occurs before the file search in the AppSearch table.
For implementing this functionality, you will unfortunately have to create your own custom action to do this for you.
How do you do this in VBScript?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: How to find a file relative to INSTALLDIR

Hi,
In fact, you can. Define a search for a folder. The result is stored in a property. This will be null if the folder wasn't found.

Now define a search for a file in the folder defined by the property name. The result is stored in another property. Works like a charm. The only trap is to make sure that the folder search occurs before the file search in the AppSearch t
That's precisely the problem. There is no way to make sure one search occurs before another, which is why I stated the behavior itself is not supported.
How do you do this in VBScript?
The script will have to search the registry by itself using some API for reading registry.
Some usage example is illustrated in this guide:
http://www.advancedinstaller.com/user-g ... eg-ca.html

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”