mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-19 04:00:19 +00:00
Add non-plugin installer download fallback
This commit is contained in:
@@ -198,6 +198,13 @@ BeveledLabel= {#APPNAM}
|
|||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
#ifndef USE_INNO_DOWNLOAD_PLUGIN
|
#ifndef USE_INNO_DOWNLOAD_PLUGIN
|
||||||
|
var
|
||||||
|
FallbackDownloadUrls: array of String;
|
||||||
|
FallbackDownloadFiles: array of String;
|
||||||
|
|
||||||
|
function URLDownloadToFile(Caller: Integer; URL: String; FileName: String; Reserved: Integer; StatusCB: Integer): Integer;
|
||||||
|
external 'URLDownloadToFileW@urlmon.dll stdcall delayload';
|
||||||
|
|
||||||
// The Inno Download Plugin isn't always installed in CI environments.
|
// The Inno Download Plugin isn't always installed in CI environments.
|
||||||
// Provide no-op fallback procedures so installer compilation still succeeds.
|
// Provide no-op fallback procedures so installer compilation still succeeds.
|
||||||
procedure idpDownloadAfter(PageID: Integer);
|
procedure idpDownloadAfter(PageID: Integer);
|
||||||
@@ -206,10 +213,40 @@ end;
|
|||||||
|
|
||||||
procedure idpClearFiles;
|
procedure idpClearFiles;
|
||||||
begin
|
begin
|
||||||
|
SetArrayLength(FallbackDownloadUrls, 0);
|
||||||
|
SetArrayLength(FallbackDownloadFiles, 0);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure idpAddFile(URL: String; Filename: String);
|
procedure idpAddFile(URL: String; Filename: String);
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
begin
|
begin
|
||||||
|
I := GetArrayLength(FallbackDownloadUrls);
|
||||||
|
SetArrayLength(FallbackDownloadUrls, I + 1);
|
||||||
|
SetArrayLength(FallbackDownloadFiles, I + 1);
|
||||||
|
FallbackDownloadUrls[I] := URL;
|
||||||
|
FallbackDownloadFiles[I] := Filename;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function idpDownloadQueuedFiles(): Boolean;
|
||||||
|
var
|
||||||
|
I: Integer;
|
||||||
|
ResultCode: Integer;
|
||||||
|
begin
|
||||||
|
Result := True;
|
||||||
|
for I := 0 to GetArrayLength(FallbackDownloadUrls) - 1 do
|
||||||
|
begin
|
||||||
|
if not FileExists(FallbackDownloadFiles[I]) then
|
||||||
|
begin
|
||||||
|
ResultCode := URLDownloadToFile(0, FallbackDownloadUrls[I], FallbackDownloadFiles[I], 0, 0);
|
||||||
|
if ResultCode <> 0 then
|
||||||
|
begin
|
||||||
|
MsgBox('Unable to download required installer dependency:' + #13#10 + FallbackDownloadUrls[I], mbError, MB_OK);
|
||||||
|
Result := False;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -332,6 +369,17 @@ end;
|
|||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
function NextButtonClick(CurPageID: Integer): Boolean;
|
function NextButtonClick(CurPageID: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
|
Result := True;
|
||||||
|
|
||||||
|
#ifndef USE_INNO_DOWNLOAD_PLUGIN
|
||||||
|
if CurPageID = wpReady then
|
||||||
|
if not idpDownloadQueuedFiles() then
|
||||||
|
begin
|
||||||
|
Result := False;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (CurPageID = wpSelectTasks) then
|
if (CurPageID = wpSelectTasks) then
|
||||||
if (WizardForm.TasksList.Checked[1] = True) then
|
if (WizardForm.TasksList.Checked[1] = True) then
|
||||||
if (WizardDirValue() = ExpandConstant('{pf64}\ZoiteChat')) then
|
if (WizardDirValue() = ExpandConstant('{pf64}\ZoiteChat')) then
|
||||||
@@ -339,8 +387,6 @@ begin
|
|||||||
WizardForm.TasksList.Checked[1] := False
|
WizardForm.TasksList.Checked[1] := False
|
||||||
MsgBox('Portable mode is only intended for use on portable drives and has been disabled.', mbInformation, MB_OK)
|
MsgBox('Portable mode is only intended for use on portable drives and has been disabled.', mbInformation, MB_OK)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Result := True; // Always continue
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user