0

How to skip automatically a download if the url doesn't exists or there isn't internet connection...? Thanks in advance & cheers... ;-)

[Code]
procedure InitializeWizard();
begin
    idpAddFile('http://127.0.0.1/test1.zip', ExpandConstant('{tmp}\test1.zip'));
    idpDownloadAfter(wpReady);
end;
4

2 回答 2

1

参考 Inno 下载插件文档,我认为最好的方法是尝试检查 url/文件是否存在,如果存在,则将其添加到下载列表中。根据文档,idpGetFileSize获取 url 中给定的文件大小,如果能够正确计算文件大小,则返回 true。尝试这个...

[Code]
procedure InitializeWizard();
var 
    size: Int64;
begin
    if idpGetFileSize('http://127.0.0.1/test1.zip', size) then
        idpAddFile('http://127.0.0.1/test1.zip', ExpandConstant('{tmp}\test1.zip'));
    idpDownloadAfter(wpReady);
end;
于 2017-04-24T09:06:10.783 回答
-1

查看下载插件文档,我发现这个选项也有效:

[Code]
procedure InitializeWizard();
begin
    idpSetOption('ErrorDialog',  'none');
    idpAddFile('http://127.0.0.1/test1.zip', ExpandConstant('{tmp}\test1.zip'));
    idpDownloadAfter(wpReady);
end;

于 2017-04-25T13:32:54.927 回答