在运行时检查安装程序是否具有 Uninstallable=True?
Check at runtime whether installer has Uninstallable=True?
我有一小段代码出现在 post- 安装步骤:
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then begin
CreateSymbolicLink(ExpandConstant('{app}\Uninstall.vsf'), ExpandConstant('{cf}\Inno Setup\Carbon.vsf'), 0)
CreateSymbolicLink(ExpandConstant('{app}\Uninstall.dll'), ExpandConstant('{cf}\Inno Setup\VclStylesinno.dll'), 0)
end;
end;
只有当安装程序有 Uninstallable=True
时,我才想容纳它来创建符号链接,我如何从 pascal 脚本中检查它?
请注意,我也假装在这样的场景中确定它:Uninstallable=not IsTaskSelected('task name')
。
使用#define
来存储值。您可以使用 ExpandConstant
.
在代码部分检查它的值
示例:
#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define Uninstallable "no"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
Uninstallable={#Uninstallable}
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then begin
if LowerCase(ExpandConstant('{#Uninstallable}')) = 'yes' then
begin
CreateSymbolicLink(ExpandConstant('{app}\Uninstall.vsf'), ExpandConstant('{cf}\Inno Setup\Carbon.vsf'), 0);
CreateSymbolicLink(ExpandConstant('{app}\Uninstall.dll'), ExpandConstant('{cf}\Inno Setup\VclStylesinno.dll'), 0);
end;
end;
end;
我有一小段代码出现在 post- 安装步骤:
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then begin
CreateSymbolicLink(ExpandConstant('{app}\Uninstall.vsf'), ExpandConstant('{cf}\Inno Setup\Carbon.vsf'), 0)
CreateSymbolicLink(ExpandConstant('{app}\Uninstall.dll'), ExpandConstant('{cf}\Inno Setup\VclStylesinno.dll'), 0)
end;
end;
只有当安装程序有 Uninstallable=True
时,我才想容纳它来创建符号链接,我如何从 pascal 脚本中检查它?
请注意,我也假装在这样的场景中确定它:Uninstallable=not IsTaskSelected('task name')
。
使用#define
来存储值。您可以使用 ExpandConstant
.
示例:
#define MyAppName "My Program"
#define MyAppVersion "1.5"
#define Uninstallable "no"
[Setup]
AppName={#MyAppName}
AppVersion={#MyAppVersion}
Uninstallable={#Uninstallable}
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then begin
if LowerCase(ExpandConstant('{#Uninstallable}')) = 'yes' then
begin
CreateSymbolicLink(ExpandConstant('{app}\Uninstall.vsf'), ExpandConstant('{cf}\Inno Setup\Carbon.vsf'), 0);
CreateSymbolicLink(ExpandConstant('{app}\Uninstall.dll'), ExpandConstant('{cf}\Inno Setup\VclStylesinno.dll'), 0);
end;
end;
end;