Ben Jost
Ben Jost

Reputation: 329

Inno Setup - "New Folder" is automatically added to a selected destination folder

I want to install/extract all files into the folder I chose from the Setup Wizard. However I don't get to it, because there is always a sub directory created.

For example, if I choose: C:\MyFolder, the installer automatically adds New Folder to it.

How do I install without any auto made sub directory?

My code:

[Setup]
DefaultDirName={sd}\
DisableDirPage=no

And here an example:

I chose Directory: C:\Users\Administrator\Desktop\Neuer Ordner\123

However it selects the directory: C:\Users\Administrator\Desktop\Neuer Ordner\123\New Folder

I don't want to use the New folder but simply use the chosen 123 folder.

Upvotes: 3

Views: 1783

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202118

By default, Inno Setup tries to preserve the last component of the path, if you choose another target path.

So if the default path (DefaultDirName) is like C:\Program Files\My Program and you choose D:\Programs, it will automatically append the My Program to become D:\Programs\My Program.

In your case, the Inno Setup is confused by the default path lacking any subfolder. And it (not really correctly) appends the New folder instead. Are you sure you really want to install to C:\ root?

Anyway, if that's intentional, set the AppendDefaultDirName to no.

See the documentation on the AppendDefaultDirName directive:

By default, when a folder in the dialog displayed by the Browse... button on the Select Destination Location wizard page is clicked, Setup automatically appends the last component of DefaultDirName onto the new path. For example, if DefaultDirName is {pf}\My Program and "Z:\" is clicked, the new path will become "Z:\My Program".

Setting this directive to no disables the aforementioned behavior. In addition, it causes a Make New Folder button to appear on the dialog.

Upvotes: 4

Related Questions