Installation InnoSetup单选按钮:定义将要安装或不安装的文件

Installation InnoSetup单选按钮:定义将要安装或不安装的文件,installation,inno-setup,Installation,Inno Setup,使用InnoSetup生成的单个可执行文件(带有“IconMain.ico”)和单个卸载(带有不同的图标“iconInst.ico”),我想在驱动器“C”和“K”中安装一些文件。不允许用户更改驱动器路径/名称,因为: STANDART RADIOBUTTON - Full installation. Files that will be installed in drive "C:" AND "K:" - Game.exe --> DRIVE C:\games - Mappin

使用InnoSetup生成的单个可执行文件(带有“IconMain.ico”)和单个卸载(带有不同的图标“iconInst.ico”),我想在驱动器“C”和“K”中安装一些文件。不允许用户更改驱动器路径/名称,因为:

STANDART RADIOBUTTON - 
Full installation. Files that will be installed in drive "C:" AND "K:"

- Game.exe     --> DRIVE C:\games
- Mapping.exe  --> DRIVE C:\Mapping
- Pics.dll     --> DRIVE C:\Pics 
- AAA.dll      --> DRIVE K:\Sounds
- BBB.obj      --> DRIVE K:\Sounds
"

我如何才能做到这一点?
谢谢大家!

要有条件地安装某个文件,需要使用参数。要安装项,需要将表达式或函数返回True,将跳过项返回False。我在上一句中链接的参考页中显示了您上一次作业的示例

因此,要将它与您提到的结合起来,您只需要创建一个函数,该函数将被分配给检查,并根据所选的单选按钮返回其结果

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

[Files]
; these two items will be installed always
Source: "AAA.dll"; DestDir: "K:\Sounds"
Source: "BBB.obj"; DestDir: "K:\Sounds"
; these three items will be installed only when the IsFullInstallation
; function returns True, what will depend on the selected radio button
Source: "Game.exe"; DestDir: "C:\Games"; Check: IsFullInstallation;
Source: "Mapping.exe"; DestDir: "C:\Mapping"; Check: IsFullInstallation;
Source: "Pics.dll"; DestDir: "C:\Pics"; Check: IsFullInstallation;

[Code]    
const
  FullDescText =
    'Full installation. Files will be installed on drives "C:" and "K:"';
  PartDescText =
    'Partial installation. Files will be installed on drives "C:" and "K:"';

var
  FullRadioButton: TNewRadioButton;
  PartRadioButton: TNewRadioButton;

procedure InitializeWizard;
var
  CustomPage: TWizardPage;
  FullDescLabel: TLabel;
  PartDescLabel: TLabel;
begin
  CustomPage := CreateCustomPage(wpWelcome, 'Installation type', '');
  FullRadioButton := TNewRadioButton.Create(WizardForm);
  FullRadioButton.Parent := CustomPage.Surface;
  FullRadioButton.Checked := True;
  FullRadioButton.Top := 16;
  FullRadioButton.Width := CustomPage.SurfaceWidth;
  FullRadioButton.Font.Style := [fsBold];
  FullRadioButton.Font.Size := 9;
  FullRadioButton.Caption := 'Full Installation'
  FullDescLabel := TLabel.Create(WizardForm);
  FullDescLabel.Parent := CustomPage.Surface;
  FullDescLabel.Left := 8;
  FullDescLabel.Top := FullRadioButton.Top + FullRadioButton.Height + 8;
  FullDescLabel.Width := CustomPage.SurfaceWidth; 
  FullDescLabel.Height := 40;
  FullDescLabel.AutoSize := False;
  FullDescLabel.Wordwrap := True;
  FullDescLabel.Caption := FullDescText;
  PartRadioButton := TNewRadioButton.Create(WizardForm);
  PartRadioButton.Parent := CustomPage.Surface;
  PartRadioButton.Top := FullDescLabel.Top + FullDescLabel.Height + 16;
  PartRadioButton.Width := CustomPage.SurfaceWidth;
  PartRadioButton.Font.Style := [fsBold];
  PartRadioButton.Font.Size := 9;
  PartRadioButton.Caption := 'Partial Installation'
  PartDescLabel := TLabel.Create(WizardForm);
  PartDescLabel.Parent := CustomPage.Surface;
  PartDescLabel.Left := 8;
  PartDescLabel.Top := PartRadioButton.Top + PartRadioButton.Height + 8;
  PartDescLabel.Width := CustomPage.SurfaceWidth;
  PartDescLabel.Height := 40;
  PartDescLabel.AutoSize := False;
  PartDescLabel.Wordwrap := True;
  PartDescLabel.Caption := PartDescText;
end;

function IsFullInstallation: Boolean;
begin
  Result := FullRadioButton.Checked;
end;

进行有条件安装的最简单方法是使用
[类型]
[组件]

[Types]
Name: standard; Description: Standard
Name: partial; Description: Partial

[Components]
Name: game; Description: Full game install; Types: standard
Name: sounds; Description: Sound files; Types: standard partial

[Files]
...; Components: game
...; Components: sounds

@特拉玛:我读了你的文章[这正是我一直在寻找的。但是我无法将其与我在网上找到的其他一些示例结合起来。您或任何人可以根据我的上述需要完成代码吗?-->将有一个installer.exe,一个unistaller.exe,用户将无法更改驱动器位置。是的,我在这里:-)现在我已经完成了n想想你以前的作业,那会更复杂。更新后的当前方式会很简单。我马上回来……很好。你详细的解释是我需要的一切。我已经在我自己的程序上测试过了,效果非常好。非常感谢你花时间在这个enlig中解决我的问题周六晚上:)谢谢米拉尔的回答。我会把你的建议保存到我以后创建的文件中。谢谢。
[Types]
Name: standard; Description: Standard
Name: partial; Description: Partial

[Components]
Name: game; Description: Full game install; Types: standard
Name: sounds; Description: Sound files; Types: standard partial

[Files]
...; Components: game
...; Components: sounds