我有一个应用程序,需要允许在同一台机器上同时安装最多三个设备。
由于某些原因,下面的代码的行为似乎是将UsePreviousAppDir设置为yes。当我第二次安装这个应用程序时,路径最终被损坏了。
我想看到的价值是
C:\Our App\install_x
,其中x对应于用户的选择。
它第一次工作,但第二次运行的结果如下所示:
C:\Our App\install_x\install_y
,其中x对应于与第一个安装一起选择的值,y对应于在此安装过程中选择的值。
安装版本是从安装程序的第一个屏幕抓取的单选按钮选择。我如何消除这个问题?
安装部分:
[Setup]
AppName=Our App
AppId=Our App
AppVerName=Our App Version(CM)
DefaultDirName=C:\Our App
DefaultGroupName=Our Group Name
OutputDir=..\
OutputBaseFilename=mm_setup
DisableStartupPrompt=yes
Compression=zip
UsePreviousAppDir=no
VersionInfoDescription=Our App Setup
CreateUninstallRegKey=no
DirExistsWarning=no
以及设置安装版本的方法:
procedure gSetVersion;
begin
if gVersionPage.SelectedValueIndex = 0 then
begin
gInstallArea := 'install_a';
end
else if gVersionPage.SelectedValueIndex = 1 then
begin
gInstallArea := 'install_b';
end
else if gVersionPage.SelectedValueIndex = 2 then
begin
gInstallArea := 'install_c';
end
WizardForm.DirEdit.Text := WizardDirValue + '\' + gInstallArea;
end;
发布于 2013-08-07 14:29:22
通过以下黑客解决了这个问题。不确定设置`UsePreviousAppDir=no‘时为什么需要手动编辑字符串,但这是可行的
procedure gSetVersion;
var
installVersionIndex: Integer;
installDir: String;
begin
case gVersionPage.SelectedValueIndex of
0: gInstallArea := 'install_a';
1: gInstallArea := 'install_b';
2: gInstallArea := 'install_c';
end
//Set the default installation folder.
//This is necessary because InnoSetup intermittently
//ignores the 'UsePreviousAppDir=no' [Setup] directive
//and because the 'DefaultDirName' directive gets populated
//prior to the user selecting the install version
installVersionIndex := Pos('install_', WizardDirValue);
installDir := WizardDirValue;
if installVersionIndex > 0 then
begin
Delete(installDir, installVersionIndex, 20);
end
WizardForm.DirEdit.Text := installDir + '\' + gInstallArea;
end;
https://stackoverflow.com/questions/18089020
复制相似问题