Inno Setup Prompt for external file location

前端 未结 1 1319
半阙折子戏
半阙折子戏 2021-01-05 22:52

I currently use [Files] Flags: external to import user data into my installation, which is working.

I now need to prompt for a specific external file d

相关标签:
1条回答
  • 2021-01-05 23:34

    Use the CreateInputFilePage function to a create custom wizard page to prompt a user for the license file.

    Then, use a scripted constant to use the selected path as a source path in the [Files] section.

    [Files]
    Source: "{code:GetLicensePath}"; DestDir: "{app}"; Flags: external
    
    [Code]
    
    var
      LicenseFilePage: TInputFileWizardPage;
    
    procedure InitializeWizard();
    begin
      LicenseFilePage :=
        CreateInputFilePage(
          wpSelectDir,
          'Select License File Location',
          'Where is your license file located?',
          'Select where License file is located, then click Next.');
    
      LicenseFilePage.Add(
        'Location of license file:',         
        'License files|*.lic|All files|*.*', 
        '.lic');                             
    end;
    
    function GetLicensePath(Param: string): string;
    begin
      Result := LicenseFilePage.Values[0];
    end;
    


    TODO: You need to handle somehow a situation, when a user does not select any license file. Either don't allow to proceed (use the NextButtonClick) or skip the file installation (use the Check parameter).

    0 讨论(0)
提交回复
热议问题