Inno Setup Editable/External 许可证文件

Inno Setup Editable/External license file

我想使用从外部文件加载的许可证创建一个 Inno Setup,以便它是可编辑的。这可能吗?

许可证应从安装程序 .exe 文件中排除,但在同一个 folder/path。

LicenseFile directive 设置为默认许可文件,使安装程序创建 "License Agreement" 页面。还要有一些后备许可证,以防外部许可证不存在。

然后在 InitializeWizard event function 加载外部许可证,如果它存在。

[Setup]
LicenseFile=default_license.txt

[Code]

procedure InitializeWizard();
var
  LicenseFile: string;
begin
  LicenseFile := ExpandConstant('{src}\license.txt');
  if FileExists(LicenseFile) then
  begin
    Log(Format('%s exists, loading a license', [LicenseFile]));
    WizardForm.LicenseMemo.Lines.LoadFromFile(LicenseFile);
  end
    else
  begin
    Log(Format('%s does not exist, keeping the default license', [LicenseFile]));
  end;
end;