我不知道,如果,我要求的是什么,这是可能的,但无论如何,我在这里:
我有以下使用Inno Download Plugin的代码:
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpReady then
begin
idpClearFiles;
if IsComponentSelected('src') then
begin
idpAddFile(
'https://cool-opensource-project.googlecode.com/files/prj-sources-1.2.3.zip',
ExpandConstant('{tmp}\src.zip'));
end;
end;
end;
我想检查一下,如果该文件已经在下载之前已经下载到文件夹中,如果不是,则下载它。
先谢谢。
答案 0 :(得分:1)
您可以通过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://cool-opensource-project.googlecode.com/files/prj-sources-1.2.3.zip',
FileName);
end;
end;
end;