Marius
Posts: 11
Joined: Wed Jun 18, 2008 3:16 pm

How to specify an install location and overwriting a file

I'm trying to create an .exe file that will search for a spesific .exe file, and launch only if that file is located on the target machine.
From there I want to install a newer version of the .exe file at the same location, overwriting the old one without asking the user to confirm, how could I do this?

Using AI professional
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: How to specify an install location and overwriting a file

Hi,

This could be done by following these steps:
- go to the Search page and create a new file search
- configure it to find the file you need
- rename the search to something meaningful, for example MY_FILE (this is actually an installer property)
- go to the "Prerequisites" page and select the Custom Launch Conditions tab
- create a launch condition which looks like this:

Code: Select all

MY_FILE      A file was not found on your machine
- use a custom action to get from the search property the path of the folder which contains the file (a sample custom action can be found in the Remove a file or a folder during installation how-to)
- use the property set by the custom action (MY_FILE for example) to create a property-based folder in the "Files and Folders" page
- place the new version of the file in this folder

When the package runs the search will try to find the file. If it is not found the MY_FILE property is empty and the custom launch condition is not met (the installation stops). Otherwise, the custom action retrieves the path of the folder which contains the file and sets it into a property. This property sets the path of a property based folder so the new version of the file will be installed in the folder of the old version.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Marius
Posts: 11
Joined: Wed Jun 18, 2008 3:16 pm

Re: How to specify an install location and overwriting a file

Alright, I think I've managed to get most of it done, however:
- use the property set by the custom action (MY_FILE for example) to create a property-based folder in the "Files and Folders" page
How do I do this?
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Re: How to specify an install location and overwriting a file

Hi,

In order to create a Property Based folder, switch to the Files and Folders page and select from the toolbar, "New folder -> Property Based", then select the Property that will be attached to that folder. Alternatively, you can select this option from the context-menu of an existing folder.

The steps are also explained in the User Guide.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”