Force app to always install in a nested folder

140 views
Skip to first unread message

JoeJohnson

unread,
Sep 8, 2023, 7:21:42 PM9/8/23
to innosetup
First time using innosetup. Here is what I'm trying to do:

I want to always put the installed app in a specified folder inside of whatever directory the user selects (or doesn't select if they left the default), regardless if the user runs the installer via CLI and uses DIR param or the wizard.

For example, say my .iss script looks like (only the relevant parts):

#define MyAppName "WpfApp" #define MyAppExeName "WpfApp.exe

[Setup] ; other stuff like AppId here DefaultDirName={autopf}\{#MyAppName} [Files] Source: "C:\Desktop\Installer\WpfApp\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\Desktop\Installer\WpfApp\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs

Now let's say I want the app to always be installed inside of a folder called "SampleApps". This means regardless of what is entered in DefaultDirName, what the user selects in the wizard, or using the DIR parameter in the CLI, it'll first make a folder called SampleApps at that location (unless it already exists) and then put the app inside it.

I tried doing something like DestDir: "SampleApps\{app}";

but that throws the error "Setup was unable to create directory "C:\WINDOWS\system32\SampleApps\C:"


Any tips would be greatly appreciated!

Wilenty org

unread,
Sep 9, 2023, 1:28:21 PM9/9/23
to innosetup
Hello JoeJohnson,
please tell us what's the reason to create your own (statically) directory after (inside) the selected install-path?

Greetings,
Wilenty

JoeJohnson

unread,
Sep 9, 2023, 5:57:21 PM9/9/23
to innosetup
Basically the system it is going on is very locked down and requires a very specific folder structure for these apps to live in. To give a bigger picture (which may or may not change solutions to my original question), there will be a single installer created that contains and executes a bunch of individual installer (all created with inno setup). The idea is to pass some sort of root folder down to the children installers, and then let the children installers create the correct folders within that root and then install to the appropriate one. As an example, say I want to install Spotify, Chrome, and VLC Player. Spotify and VLC Player must go inside of a folder called MediaPlayers, and Chrome must go in a folder called Browsers.

So I would have a main installer, and I'd pass some root folder, either by CLI or the wizard, down to the child installers, let's say I just pick a folder on the user's desktop called Test. So the final structure after all the installations are complete would look like:

Desktop
-- Test
------ MediaPlayers
----------- Spotify
----------- VLC Player
------ Browsers
----------- Chrome

It should still work if the children installers are executed on their own as well.

Wilenty org

unread,
Sep 9, 2023, 7:11:59 PM9/9/23
to innosetup
Hello JoeJohnson,
if you want to execute sub-installers, create them based on Components or Tasks.
And, you can "transfer" install-path via parameter "/DIR=(...)\MediaPlayers\Spotify", "/DIR=(...)\Browsers\Chrome", etc. to the sub-installers, so, you don't need to have any sub-folder in the install-path...

Please look what I did in my custom installer for Notepad3: https://github.com/Wilenty/Notepad3/releases/tag/6.23.903.1

Original (signed) installers are there:
"BETA/RC Setup versions (with all BETA/RC features/fixes at build date)": https://github.com/rizonesoft/Notepad3/issues/1129
and compiled portable are there: https://github.com/rizonesoft/Notepad3/pull/4985

Greetings,
Wilenty

JoeJohnson

unread,
Sep 11, 2023, 4:09:53 PM9/11/23
to innosetup
Thank you! I believe it is working with your suggestions. Appreciate it !
Reply all
Reply to author
Forward
0 new messages