[Files] section: Download file: Reference downloaded file later?

40 views
Skip to first unread message

Bill Stewart

unread,
Aug 10, 2026, 4:26:40 PM (3 days ago) Aug 10
to innosetup
I am testing building an installer that uses a [Files] section line like this:

Source: {code:GetDownloadURL}; DestDir: {app}; DestName: "download.zip"; ExternalSize: 0; Flags: download external extractarchive ignoreversion recursesubdirs createallsubdirs

I would like to be able to access this downloaded zip file later in the CurStepChanged event procedure (when CurStep = ssPostInstall) to do some other things with the downloaded file:

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssPostInstall then
  begin
    if not FileExists(ExpandConstant('{app}\config.json')) then
    begin
      // download.zip path isn't in {tmp} - how do I find it?
    end;
  end;
end;

It seems the downloaded file isn't in {tmp} -- how do I get to it?

Eivind Bakkestuen

unread,
Aug 11, 2026, 7:37:27 AM (2 days ago) Aug 11
to inno...@googlegroups.com
Since " DestDir: {app}" is used... doesn't it end up in {app} and not in {tmp}? (Haven't tested the download functionality)

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/innosetup/b2e6f8ab-93ac-41c8-9685-2cab5df83b83n%40googlegroups.com.

Martijn Laan - Inno Setup

unread,
Aug 11, 2026, 8:54:25 AM (2 days ago) Aug 11
to inno...@googlegroups.com
Hi,

Op 10-8-2026 om 22:26 schreef 'Bill Stewart' via innosetup:
It seems the downloaded file isn't in {tmp} -- how do I get to it?

The name of it is {tmp}\_isetup\is-XXXXXXXXXX.tmp\download.zip, where XXXXXXXXXX is 10 random base36 characters, which is A-Z + 0-9.

Greetings,
Martijn

Martijn Laan - Inno Setup

unread,
Aug 11, 2026, 8:55:36 AM (2 days ago) Aug 11
to inno...@googlegroups.com
Hi,

Op 11-8-2026 om 13:37 schreef Eivind Bakkestuen:
Since " DestDir: {app}" is used... doesn't it end up in {app} and not in {tmp}? (Haven't tested the download functionality)

It would, if the externalarchive flag wasn't also used. In that case the extracted files end up in {app}, and the download archive itself in {tmp}.

Greetings,
Martijn

Bill Stewart

unread,
Aug 11, 2026, 8:56:43 AM (2 days ago) Aug 11
to innosetup
On Tuesday, August 11, 2026 at 5:37:27 AM UTC-6 Eivind Bakkestuen wrote:

Since " DestDir: {app}" is used... doesn't it end up in {app} and not in {tmp}? (Haven't tested the download functionality)

When the extractarchive flag is set, DestDir specifies where the downloaded archive file should get extracted. (This doesn't seem to be explicitly spelled out in the documentation.)

Martijn Laan - Inno Setup

unread,
Aug 11, 2026, 9:24:00 AM (2 days ago) Aug 11
to innosetup
Hi,

Op 11-8-2026 om 14:56 schreef 'Bill Stewart' via innosetup:
When the extractarchive flag is set, DestDir specifies where the downloaded archive file should get extracted. (This doesn't seem to be explicitly spelled out in the documentation.)

I have added two notes, see https://github.com/jrsoftware/issrc/commit/603178a89306456013cd37bf78ca8a101246d800

This will be in 7.2.0, and not yet in 7.1.0.

Greetings,
Martijn

Bill Stewart

unread,
Aug 11, 2026, 9:33:15 AM (2 days ago) Aug 11
to innosetup
On Tuesday, August 11, 2026 at 7:24:00 AM UTC-6 Martijn Laan - Inno Setup wrote:


Nice. For now I have written this:

function FindFile(const FileName, StartDir: string): string;
var
  FindRec: TFindRec;
  FilePath: string;
begin
  result := '';
  if FindFirst(AddBackslash(StartDir) + '*', FindRec) then
  try
    repeat
      if (FindRec.Name <> '.') and (FindRec.Name <> '..') then
      begin
        FilePath := AddBackslash(StartDir) + FindRec.Name;
        if FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0 then
          result := FindFile(FileName, FilePath);
        if result <> '' then
          break;
        if SameText(FileName, FindRec.Name) then
        begin
          result := FilePath;
          break;
        end;
      end;
    until not FindNext(FindRec);
  finally
    FindClose(FindRec);
  end;
end;

I can now write FindFile('download.zip', ExpandConstant('{tmp}')) to get the full path of the downloaded file, but it would be nice if there was a way to get it without having to search.
Reply all
Reply to author
Forward
0 new messages