Inno Setup - how to use a user selected directory defined by a msgbox selection in the [files] destination

Viewed 36

so we have a desktop application that now also needs to be installed on an SBC on an instrument with a small attached monitor as well. we want one installer for both, but they need to be installed in different directories.

In the setup I have the DefaultDirName pointing to code

DefaultDirName={code:ChooseDir}

the code is a little janky, but it's basically a messagebox that says "Is this a desktop Installation? No for {ourinstrument}". The user selects yes or no and that determines the installation directory.

function ChooseDir(Param: string): String;
var
  FinalDir: String;
begin
  case MsgBox('Desktop Installation?'#13#10'No for Centurion OS', mbConfirmation, MB_YESNO) of 
    IDYES: FinalDir := '{autopf}\{#MyAppName}';
    IDNO: FinalDir := 'C:\Encon Evolution\{#MyAppName}';
  end;
  Result := FinalDir;
end;

this all appears to be working fine, however when it gets to the files I can't figure out how to use the selected directory or DefaultDirName to prepend the DestDir:

[Files]
Source: "C:\github\firmware\Production\EnconEv\Stealth\bin\Release\CyUSB.dll"; DestDir: "{app}\Encon"; Flags: ignoreversion
Source: "C:\github\firmware\Production\EnconEv\Stealth\bin\Release\Default.mth"; DestDir: "{app}\Encon"; Flags: ignoreversion
Source: "C:\github\firmware\Production\EnconEv\Stealth\bin\Release\Default.xml"; DestDir: "{app}\Encon"; Flags: ignoreversion

basically, i need to replace {app} with the selected directory and for the life of me I can't figure out how to do it. Thanks in advance!

0 Answers
Related