gpt4 book ai didi

installation - 在运行时检查安装程序是否有 Uninstallable=True?

转载 作者:行者123 更新时间:2023-12-03 19:50:37 25 4
gpt4 key购买 nike

我在安装后步骤中有一小段代码:

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 时,我才愿意使用它来创建符号链接(symbolic link)。 ,我怎么能从帕斯卡脚本中检查呢?

请注意,我还假装在这样的场景中确定它: 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;

关于installation - 在运行时检查安装程序是否有 Uninstallable=True?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33041102/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com