gpt4 book ai didi

inno-setup - 检查先前是否在 Inno Setup 中下载过组件

转载 作者:行者123 更新时间:2023-12-02 03:37:55 26 4
gpt4 key购买 nike

我不知道,如果我要求的是可能的,但无论如何,我开始了:

我有以下使用 Inno 下载插件的代码:

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpReady then
begin
idpClearFiles;
if IsComponentSelected('src') then
begin
idpAddFile(
'https://example.com/files/prj-sources-1.2.3.zip',
ExpandConstant('{tmp}\src.zip'));
end;
end;
end;

我想在再次下载之前检查文件是否已经下载到文件夹中,如果没有,则下载它。

最佳答案

您可以通过 FileExists 检查文件是否存在功能。在你的情况下它会是这样的:

procedure CurPageChanged(CurPageID: Integer);
var
FileName: string;
begin
if CurPageID = wpReady then
begin
idpClearFiles;
{ better use a local variable to avoid expanding the same path twice }
FileName := ExpandConstant('{tmp}\src.zip');
{ if the component item is checked and file does not exist yet, enqueue it }
if IsComponentSelected('src') and not FileExists(FileName) then
begin
idpAddFile(
'https://example.com/files/prj-sources-1.2.3.zip',
FileName);
end;
end;
end;

关于inno-setup - 检查先前是否在 Inno Setup 中下载过组件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22114401/

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