Inno Download Plugin: skip download if not exists...?

517 views Asked by At

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;
2

There are 2 answers

1
Sam On BEST ANSWER

Referring the Inno download plugin documentation I think the best possible way is to try and check if the url/file exists and if it does then add it to the download list. According to the docs the idpGetFileSize gets the size of the file given in the url and returns true if it was able to calculate the file size without fail. Try this...

[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;
2
alfreire On

Looking in download plugin documentation I found this option that works too:

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