Peter R
Posts: 16
Joined: Tue Oct 31, 2006 6:36 pm

Vista property-based folder problem

I have a problem with an update installer which works fine on XP, but fails on Vista. The installer searches for an previous install, and then replaces changed files in the previous install folder.

On XP, the new files are properly installed in the expected folder. But on Vista, a new folder with the name of the property is created instead, and the files are installed there, rather than in the proper target folder. For example:
- we search for our program "MyProgram.exe"
- from there, we search for the parent folder and remember it at "FOUND_FOLDER" (which would be C:\Program Files\MyProgramFolder\)
- The installer then installs files in a property-based folder
- On XP, files are properly installed in C:\Program Files\MyProgramFolder\
- But on Vista, the installer creates a new folder "C:\FOUND_FOLDER\", and places the new files there.

Any suggestions?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

This happens because on Vista the folder is not found. Since the folder is used in the "Files and Folders" page and it contains files, it must have a valid path. Therefore, when the folder is not found the name of the folder in "Files and Folders" page is used to create a folder on the primary partition.

Please make sure that the folder searched by the installation package exists on the target machine. Also, make sure that you have correctly configured the search.

You can read about the "Search" page here:
http://www.advancedinstaller.com/user-guide/search.html

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Peter R
Posts: 16
Joined: Tue Oct 31, 2006 6:36 pm

The folder does exist on Vista. The search works perfectly fine on XP, and I am actually checking the result of the search, and abort the install if a previous version is not found. The test sequence is the same - install an older version in the install location, check that the install worked ok, then apply the updater. Works on XP SP2, but not on Vista Business.

The search is actually a 2-step search. The idea is to first look for the executable by name, since the executable name is fixed. If this search fails, the installer will abort.
The location of the executable is then used for a second, limited search (depth=2) to look for a folder that contains part of the name (since the install folder may be renamed during install, often by appending a version number).

Something is different about the searches on Vista - but what? Could perhaps be the order (the second search must be done after the first search, but it is listed first in the Advanced Installer GUI). Or do searches on Vista only go down, but not up (we want the enclosing folder for the executable)? Or something else?
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
Could perhaps be the order (the second search must be done after the first search, but it is listed first in the Advanced Installer GUI).
Note that the order of the searches specified in the MSI is not guaranteed by Windows Installer, therefore it is not recommended to use a search which depends on another search.

Since your second search is based on the first search, most likely this is the cause of your problem. The solution is to remove the second search (the one that depends on the first search) and use a custom action which searches the folder you need.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Peter R
Posts: 16
Joined: Tue Oct 31, 2006 6:36 pm

Note that the order of the searches specified in the MSI is not guaranteed by Windows Installer
Bummer, since this worked perfectly so far on XP.

So, how do I get the enclosing folder for the result of the first search? An independent search is not possible, since the name of the folder is user-chosen, and even if it is the default, other folders with the same name are present on the system (for preferences, automatic updater cache, ...).
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,
The search is actually a 2-step search. The idea is to first look for the executable by name, ... The location of the executable is then used for a second, limited search (depth=2) to look for a folder
In this case you can configure a search in the "Search" page that will find the EXE. The folder will be searched by using a custom action which uses the result of the search (usually the property of the search is RESULT_PROPERTY).
So, how do I get the enclosing folder for the result of the first search?
If you are referring to getting the path of the folder in which the EXE is found then this can be done by using a custom action.

Here is a sample VBScript that does this:

Code: Select all

path=Session.property("RESULT_PROPERTY")
smallPath=Left(path,InStrRev(path,"\")-1)
MsgBox(smallpath)
Replace RESULT_PROPERTY with your search property.
An independent search is not possible, since the name of the folder is user-chosen,
Like I said in my previous post, you can use a custom action which searches the folder you need. This custom action can use the value of the first search to find the folder you need.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”