dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Check if folder exists & Install files on existing folder

Hi,

I want to have custom installation path when installer runs, I have two different databases based on this I want installer to identify installation location, Installation path can be c:\MySQL or c:\PostgreSQL.

Can installer identify the folder name and copy required files, If Folder name is c:\MySQL then installer should copy MySQL files automatically to c:\MySQL directory . If Folder name is c:\PostgreSQL then installer should copy postgresql files to c:\PostgreSQL folder location

Can anyone let me know how can Advanced installer check which folder exist on user workstation and based on that copy necessary files (C:\MySQL or C:\PostgreSQL) ?

Thanks
Dhaval Joshi
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Check if folder exists & Install files on existing folde

Hello and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

In order to achieve that you can have a search to find what folder is on the target machine and install the components in related folder.

In order to search for a folder you can go in the “Search” page where you can use the [New Search Wizard] toolbar button to create a new search using the wizard and following step-by-step directions. You can also test your search using the [Test Search] toolbar button.
You can also take a look on Folder Location Properties article which may be useful to you.

So you will have to do two search operations: one folder search operation for the “MySQL” folder and one for “PostgreSQL” folder to see what folder is on the target machine.
Also you can take a look on Search Folder On All Drives thread which may be useful.

Now you can go in the “Files and Folders” page where you can add a property-based folder using the [Folder] >> [Property-Based] toolbar button and select the name of the search used for “MySQL” folder. Place in this folder the related files.
Add a new property-based folder and select the name of the search used for “PostgreSQL” folder. Place in this folder the related files.

Now you can go in the “Organization” page where you can condition the installation of a component. When you added a property-based folder in the “Files and Folders” page for each property-based folder that you have used a component has been automatically created. All the resources from a property-based folder are added together to a component.
Now you can select the component and in the “Condition” field you can use the search name to condition the installation of that component.

If the folder does not exist on the target machine(e.g. MySQL folder) then the property of the search result will be null and so the related component will not be installed.

I have also attached a .zip archive where you can find a sample project which implements this scenario.

Let me know if you need any help.

Best regards,
Dan
Attachments
sample.zip
(2.94 KiB) Downloaded 682 times
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
dhaval0129
Posts: 34
Joined: Mon Jul 22, 2013 7:19 pm

Re: Check if folder exists & Install files on existing folde

Hi,

Thanks for reply, I forgot mention that I have few batch scripts which are particular to MySQL and PostgreSQL, How do I execute this batch scripts based upon type of Installation location (MySQL or PostgreSQL)
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Check if folder exists & Install files on existing folde

Hi,

In order to achieve that, you can go in the “Custom Actions” page, and add two predefined “Launch attached file” predefined custom actions with sequence, one that will execute the batch scripts when the MySQL folder is found on the target machine and one that will be execute the batch scripts when the PostgreSQL folder is found on the target machine.


The condition that can be used for the custom action that will execute the batch scripts when the bMySQL folder is on the target machie can be something like: MYSQL_PATH >< "MySQL" where:
-MySQL_PATH is the property of the search that contains the path of the MySQL folder if it is on the target machine.
>< - Sub-String Operator which is TRUE if left string contains the right string.
”MySQL” the string used to see if the folder has been found on the target machine.

A similar condition can be used for the custom action that will execute the batch scripts when the PostgreSQL folder is on the target machine: POSTGRE_PATH >< "PostgreSQL" .

You can also take a look in the Sub-String Operators article which may be useful to you.
Please notice that I have used a similar condition in the “Organization” page to condition the installation of the property-based folders components.

By the way, have you noticed in the SQL Scripts page our suport for SQL Scripts? You can add the SQL scripts in our SQL Scripts page and use a condition in the "Condition" field from "SQL Script" tab.

I attached a .zip archive containing a sample which implements a similar scenario.

Best regards,
Dan
Attachments
NewSample.zip
(3.67 KiB) Downloaded 507 times
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”