(NL)NOOTLORD
Posts: 3
Joined: Tue Apr 13, 2021 4:46 pm

Quick question about the *Select Installation Folder* proccess

Tue Apr 13, 2021 4:59 pm

Hi everyone,
I am running into a little issue when i browse and change my installation directory in the installer, ill explain with a example what i mean with this:

My app is called Pingu and has files in the Application Folder in the Files and Folders tab.
I compiled the installer and when its time to choose the install directory it will display default path which is: C:\Program Files\Pingu\.
But when i click on Browse and navigate to the C: or the D: drive the \Pingu\ part is lost and it will install my files into the root of the C: or D: drive instead of making a folder called Pingu. How can i autofill \Pingu\ when i change folders in the browse menu so it will always create a folder called Pingu even when the user chooses to change the default install directory?

I have being using Inno Setup Compiler in the past and in that software package this behavior works right out of the box.
I am wondering is the same functionality is possible in Advanced Installer. Hopefully my question is clear enough if not feel free to comment this out.

Thanks in advanced
(NL)NOOTLORD

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

Re: Quick question about the *Select Installation Folder* proccess

Tue Apr 13, 2021 7:23 pm

Hello and welcome to our forums,

Here is the logic I have thought of in order to achieve what you want:

Basically, the installation path is stored in a property - APPDIR. When the dialog where you can change the path is initialized, we store this property's value into another property, e.g.:

OLD_APPDIR = APPDIR

Now, after the user have chosen a new path, we will append to it the ProductName property if the APPDIR != OLD_APPDIR (we do this only if the path has been modified).

Here is a step-by-step you can follow in order to achieve that:

- go to "Custom Actions"

- here, add a new "Set property" custom action, without sequence (click the "Add custom action without sequence" button which is located to the right side of the custom action's name)

Property: OLD_APPDIR
Value: [APPDIR]


- add a new "Set property" custom action, without sequence. This time, the custom action should look as it follows:

Property: APPDIR
Value: [APPDIR][ProductName]


- now please go to "Dialogs" page and select the "FolderDlg" dialog

- under "Init Events" tab, add the first custom action (the one that sets OLD_APPDIR -> [APPDIR])

- now please select the "Next" button and, under "Published Events" tab, add the second custom action, as it follows:
Set_Property.png
Set_Property.png (158.87KiB)Viewed 2917 times
Please find attached below, for your reference, a sample project that implements the steps presented above:
Sample Project.aip
(12.89KiB)Downloaded 179 times
Hope this helps!

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

(NL)NOOTLORD
Posts: 3
Joined: Tue Apr 13, 2021 4:46 pm

Re: Quick question about the *Select Installation Folder* proccess

Wed Apr 14, 2021 9:54 am

Hi,
Thank you for your reply and for providing a sample file.
I got it working but it has a weird issue when i press Next a few times it keeps adding the APPDIR to the install patch so i ended up with D:\Pingu\Pingu\Pingu\Pingu\.
Also is there a way to update the Folder: Bar when the APPDIR is added? The APPDIR folder only shows up when u press Next and then chooses "Back" i would like to have it update when the user has chosen there new path so people don't think there gonna install the program in there C: or D: drive. What i mean is when they browse and change it to the D: drive it still shows D: not D:\Pingu\ as it seems the Folder: bar does not update untill u press Next. Is there a way to get this working? And is there a way to stop the installer making new APPDIR folders if 1 is already made?
Hope to hear from u soon.

Kind regards
(NL)NOOTLORD

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

Re: Quick question about the *Select Installation Folder* proccess

Wed Apr 14, 2021 7:39 pm

Hello,

You are indeed right about that - it looks like there was a flaw in my previous logic.

I have done some further tests and I believe I found a better way of achieving this.

What we have to do now is move the published event from the "Next" button of the "FolderDlg" dialog to the "Ok" button of the "BrowseDlg" dialog:
SetAppdir.png
SetAppdir.png (81.46KiB)Viewed 2902 times

This way, the path will also be updated in the "FolderDlg", therefore the user will know the program will be installed under the concatenated path (APPDIR + ProductName).

However, there would be a corner case for this:

If the user chooses to change the default path, the new APPDIR will be formed, e.g.:

Code: Select all

C:\Pingu
If the user will select "Browse" again without modifying the path and click "Ok", the custom action will once again be executed, resulting in the path being:

Code: Select all

C:\Pingu\Pingu
Hope this helps!

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

(NL)NOOTLORD
Posts: 3
Joined: Tue Apr 13, 2021 4:46 pm

Re: Quick question about the *Select Installation Folder* proccess

Wed Apr 14, 2021 8:32 pm

Hi,
Thanks for the quick reply!
This is what i am looking for thanks! The little flaw is not a big deal atleast the user knows that it doubles the folder name and they can correct it themselfs :lol: Once again many thanks for your help its greatly appriciated! :D

Kind regards
(NL)NOOTLORD

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

Re: Quick question about the *Select Installation Folder* proccess

Thu Apr 15, 2021 3:41 pm

You are always welcome!

I am really glad I was able to help.

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

Return to “Building Installers”