I'm using Inno Setup 6.1.2. I've made an installer that downloads zip and 7z files off the internet,and it should then after installing them, uncompress them to {app} directory,and at the end delete zip and 7z files,while keeping extracted content intact.
The problem is,instead of that,it doesn't uncompress files,it just downloads them to {app} directory.I've tried using deleteafterinstall
flag,but it just deletes zip and 7z files,resulting in downloading only non-external files.
I want the installer to delete zip and 7z files after uncompressing them to specific directory.How can i do that?
Here's the code:
[Setup]
DefaultDirName=C:\Program Files (x86)\example
DisableDirPage=no
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
PrivilegesRequired=admin
PrivilegesRequiredOverridesAllowed=commandline
OutputDir=C:\example1\Output
OutputBaseFilename=test
SolidCompression=yes
Compression=lzma
WizardStyle=modern
[Files]
Source: "{src}\example2.7z"; DestDir: "{app}"; Flags: external
Source: "C:\a\b.ini"; DestDir: "{app}\example2\something1"; Flags: ignoreversion recursesubdirs
Source: "{src}\example3.7z"; DestDir: "{app}\example2\something1"; Flags: external
[Code]
var
DownloadPage: TDownloadWizardPage;
function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;
begin
if Progress = ProgressMax then
Log(Format('Successfully downloaded files to {app}: %s', [FileName]));
Result := True;
end;
procedure InitializeWizard;
begin
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpReady then begin
DownloadPage.Clear;
DownloadPage.Add('https://example.com/example2.7z', 'example2.7z', '');
DownloadPage.Add('https://example.com/example3', 'example3.7z', '');
DownloadPage.Show;
try
try
DownloadPage.Download; // This downloads the files to {app}
Result := True;
except
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
Result := False;
end;
finally
DownloadPage.Hide;
end;
end else
Result := True;
end;