How to ask the user to specify a folder name (usin

2019-04-14 07:28发布

问题:

I have to install an application that relies on a web server (XAMPP), so I'd like to add to my setup wizard a form that notifies the user if a given folder (of XAMPP) does not exist, then to provide a textbox and to ask the user to specify a folder name where this web server is installed.

I'd like to keep this folder name as a variable, since later I have to place some files in that folder.

Can you guide me how to do so?

Thank you

回答1:

Use the CreateInputDirPage function to create the page/form.

Use a scripted constant to install the files to the selected folder.

[Files]
Source: "somefile.txt"; DestDir: "{code:GetOtherDir}"

[Code]

var
  OtherInputDirPage: TInputDirWizardPage;

procedure InitializeWizard;
begin
  OtherInputDirPage :=
    CreateInputDirPage(wpSelectDir, 'Select xampp directory', '', '', False, '');
  OtherInputDirPage.Add('');
end;

function GetOtherDir(Param: String): String;
begin
  Result := OtherInputDirPage.Values[0];
end;

You should add some validation.

See also the article Prompt for an additional folder for data on ISXKB.



标签: inno-setup