Lolico
Posts: 2
Joined: Tue Jul 27, 2021 4:08 am

How to add subdirectories automatically after selecting a path

Fri Jul 30, 2021 8:56 am

I want to append a directory to the returned directory after the user selects a directory.
For example.
The user clicks the Browse button -> selects C:/, the corresponding PathEditor should show C:/MyAPP/ and the program should be correctly installed there

Catalin
Posts: 4358
Joined: Wed Jun 13, 2018 7:49 am

Re: How to add subdirectories automatically after selecting a path

Fri Jul 30, 2021 1:28 pm

Hello,

The easies way to achieve this would be to set the property that stores the path (APPDIR) to a new value.

To do so, you can go to "Dialogs" page --> select "FolderDlg" dialog, click on the "Next" button and under "Published Events" add a new event as it follows:

Set Installer property value
Property: APPDIR
Argument: [APPDIR]MyApp
Condition: <leave unchanged>


However, with this approach, there is a corner case. For instance, if the user will choose C:\, the installer will install the files in C:\MyApp. However, if the user clicks on the "Next" button and then goes back, the next time he presses the "Next" button, the event will be executed once again, resulting in the path being duplicated, e.g.: C:\MyApp\MyApp.

More information and a solution can be found in the following thread:

Quick question about the *Select Installation Folder* proccess

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”