S S
S S

Reputation: 5

Inno Setup Download Plugin is failing with "Download failed: Cannot create file"

I have been attempting to make an installer for an application where the required files are on a server. I am using Inno Setup with Inno Download Plugin. During the download portion of the setup I'm getting the following error:

Download failed: Cannot create file %tempFileLocation%\%filename%.zip".

I'm not sure if the error is an ability not to connect to the server, permission issue within the temp directory, or what the problem is. If I put the URL used directly into a browser I can download the file with no problems.

procedure InitializeWizard;
begin
    idpAddFile('%URL', ExpandConstant('{tmp}\%directory%\%filename%.zip'));

    idpDownloadAfter(wpReady);
end;

Everything with the '%' signs are actual hard coded values. Any help either resolving this issue or pointing me to a better resource than what I've found on my own would be appreciated.

Upvotes: 0

Views: 838

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202108

You are trying to download the file to a directory that does not exist.

The [Dirs] section is processes only after the user confirms the installation. While the InitializeWizard is run even before the wizard shows.

As I assume you need the file downloaded before the installation starts, you have to create the directory in the code using CreateDir function, not using the [Dirs] section, like:

CreateDir(ExpandConstant('{tmp}\%directory%'));

Upvotes: 0

Related Questions