Search code examples
inno-setuppascalscriptinno-download-plugin

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


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;

Solution

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