MattFW
Posts: 18
Joined: Fri Jul 06, 2007 4:54 am

Installing one of 3 identically named files on conditions.

Hi there,

I've just started using AI and I'm finding it pretty easy but there's one question I have.

The product I am trying to install supports 3 languages internally and identifies which language to display when you run it using a file stored in Application Data. This file is called 'language.prs'.

When the installer runs, I want it to install a version of language.prs based on the user's current language settings (English, French, or German).

I looked at the component conditional options and that seemed to give me what I want but I cannot see how I can add 3 different versions of the file called 'language.prs' to my 'Files and Folders', given that the 3 versions all have the same name and AI warns about duplicate names.

I can't find a way currently to store those 3 versions of the file in the installer structure so that one of them will be copied to the Application Data folder. I remember with the MSI creator in Dev Studio that I could add language_EN.prs and rename it at install time to language.prs, which would work here, but I can't find how to do that in AI.

Any help would be much appreciated, thanks!
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Matt,
I looked at the component conditional options and that seemed to give me what I want but I cannot see how I can add 3 different versions of the file called 'language.prs' to my 'Files and Folders', given that the 3 versions all have the same name and AI warns about duplicate names.
The idea would be to add each file in a distinct subfolder (of the directory where the file should reside, for instance "Application Data\MyApp") and then use several "Directory Set with Formatted" Custom Actions in order to redirect the contents of these subfolders to the destination directory.

For instance, if "language.prs" is to be installed under "Application Data\MyApp", create 3 subfolders ("en", "fr", "de") under this directory in the Files and Folders page. Add the correct instance of the file under each subfolder.

In the Custom Actions page, select from the toolbar "Show Standard Action -> Before File Installation -> InstallInitialize".

Under "InstallInitialize" add 3 "Directory Set with Formatted" Custom Actions, each time specifying one of the subfolders ("en", "fr" or "de") to be redirected to the destination folder of the file - select this folder by clicking the "Edit" button at the right of the "Formatted Text" field.

Because you will use mutual exclusive conditions for the Components attached to these files, only one of the them will be installed.

As a note, renaming the file at install time (via a Custom Action) is another option but I do not recommend it. You should use the approach described above. If you need an example project send an email to support at advancedinstaller dot com.

Hope this helps.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
wathiant
Posts: 4
Joined: Mon Apr 23, 2007 8:26 am

I have a follow-up question...

I'm doing a similar thing, but instead of a language file, I'm supplying an encrypted settings file (based on the serial key). We currently have 3 versions of these settings and the solution suggested by Ionut works like a charm.

However, also depending on the serial key, the same file needs to be installed in 1, 2 or 3 locations. This is currently done by having 9! "Directory Set with Formatted" actions. Since we may increase the number of available versions in the near future, I'm curious if there's an easy way to copy the final file from the first location to the other 2 locations.

There is one location where the file will always be installed, so I can use that as a fixed base location. I've tried several things to copy the file to other places, but I can't seem to get it to work (maybe I'm overlooking a simple solution?).

Some help would be appreciated :)
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

For what you need you can try to use File Copy/Move operations which will copy the original file to the folders you need. You can read more about this feature here:
http://www.advancedinstaller.com/user-g ... ialog.html

These file operations will be created in the target directories in the "Files and Folders" page and in the "New File Copy/Move" dialog you will use the "..." button to select the original location of the file (the target location is added automatically).

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

Return to “Common Problems”