我在安装后的步骤中发现了这段代码:
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')
。
答案 0 :(得分:2)
使用#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;