Trang D
Trang D

Reputation: 327

How to keep the original folder name (AppendDefaultDirName equivalent) on a custom page created with CreateInputDirPage

I want to keep the original folder name as it is. So when selecting the location on custom directory page, Inno Setup should keep the default folder name unless manually overwritten by the user. That is, if the default location is c:\MS, if the user selects d:\ drive, then it must be d:\MS.

Have tried setting AppendDefaultDirName to yes. But still I am not getting the expected result.

[Setup]
DefaultDirName={tmp}\MyProg
AppendDefaultDirName=yes

[Code]

procedure InitializeWizard();
begin
  DirPage := CreateInputDirPage(
    wpSelectDir, 'Directory Selection', 'Choose where to install.', false, '');
  DirPage.Add('Select Custom Location ');
  DirPage.Values[0] := GetPreviousData('Directory1', 'C:\MS');
end;

Upvotes: 2

Views: 207

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202340

Set CreateInputDirPage arguments like this:

  • AAppendDir to True;
  • ANewFolderName to 'MS':
CreateInputDirPage(
  wpSelectDir, 'Directory Selection', 'Choose where to install.', '', True, 'MS');

(AppendDefaultDirName has no effect on CreateInputDirPage)


For a similar, but more complex question, see:
Inno Setup custom page with multiple destination folders that behave like the normal folder select page

Upvotes: 1

Related Questions