I want to install two files into a installation directory. The directory shall be selected by the user during installation and shall be created if it does not exist. A default path shall be proposed.
What I have so far is:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=Testapp
AppVersion=1.0
DefaultDirName={code:GetOtherDir}
DefaultGroupName=TestProgram
PrivilegesRequired = lowest
OutputBaseFilename =TestProgram
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "program.exe"; DestDir: "{app}"
Source: "readme.txt"; Flags: onlyifdoesntexist; DestDir: "{app}"
[Icons]
Name: "{userdesktop}\Subdirectory"; Filename: "{userdocs}\Subdirectory\program.exe"; Tasks: desktopicon
[Code]
var
OtherInputDirPage: TInputDirWizardPage;
procedure InitializeWizard;
begin
OtherInputDirPage :=
CreateInputDirPage(wpSelectDir, 'Installationsverzeichnis wählen:', '', '', False, '');
OtherInputDirPage.Add('');
// Set initial value (optional)
OtherInputDirPage.Values[0] := ExpandConstant('{userdocs}\Subdirectory');
end;
function GetOtherDir(Param: String): String;
begin
Result := OtherInputDirPage.Values[0];
end;
I am able to install one single file into a user defined location with a different code, but I am not able to use that location also for the second file, so this is why I came up with the code above. Can anyone help?
The code you are trying seems unnecessarily complicated for such a trivial task. A basic Inno Setup script for installing two files into user-selected directory is like:
You possibly got confused, because you have the application installed already and the standard directory selection page does not show. See:
Inno Setup generated installer does not show "Select Destination Location" page on some systems