Skip to content

Commit

Permalink
* Removed the font download and just stuck it directly in the codebas…
Browse files Browse the repository at this point in the history
…e. (#218)
  • Loading branch information
joncage authored Feb 7, 2025
1 parent 9da3216 commit e204c24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 73 deletions.
77 changes: 4 additions & 73 deletions Installer/EdScoutInstaller.iss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
AppId={{2C9BD960-4759-4484-80D2-70047F48AAC4}
AppName=Elite Dangerous Scout
AppVersion={#FullVersion}
AppPublisher=Jon Cage Software
AppPublisherURL=https://github.com/joncage/ed-scout
AppSupportURL=https://github.com/joncage/ed-scout/issues
WizardStyle=modern
DefaultDirName={autopf}\EDScout
; Since no icons will be created in "{group}", we don't need the wizard
Expand All @@ -21,83 +24,11 @@ SetupIconFile=..\EDScoutWebUI\static\favicon.ico

[Files]
Source: "dist-singlefile\EDScout.exe"; DestDir: "{app}"
Source: "{tmp}\eurostile.TTF"; DestDir: "{autofonts}"; FontInstall: "Eurostile"; Flags: onlyifdoesntexist uninsneveruninstall external
Source: "eurostile.TTF"; DestDir: "{autofonts}"; FontInstall: "Eurostile"; Flags: onlyifdoesntexist uninsneveruninstall external

[Icons]
Name: "{autoprograms}\EDScout"; Filename: "{app}\EDScout.exe"
Name: "{autodesktop}\EDScout"; Filename: "{app}\EDScout.exe"

[Run]
Filename: {app}\EDScout.exe; Description: Run EDScout now; Flags: postinstall nowait skipifsilent

[Code]
var
DownloadPage: TDownloadWizardPage;
function OnDownloadProgress(const Url, FileName: String; const Progress, ProgressMax: Int64): Boolean;
begin
if Progress = ProgressMax then
Log(Format('Successfully downloaded file to {tmp}: %s', [FileName]));
Result := True;
end;
procedure InitializeWizard;
begin
DownloadPage := CreateDownloadPage(SetupMessage(msgWizardPreparing), SetupMessage(msgPreparingDesc), @OnDownloadProgress);
DownloadPage.ShowBaseNameInsteadOfUrl := True;
end;
const
NO_PROGRESS_BOX = 4;
RESPOND_YES_TO_ALL = 16;
procedure UnZip(ZipPath, FileName, TargetPath: string);
var
Shell: Variant;
ZipFile: Variant;
Item: Variant;
TargetFolder: Variant;
begin
Shell := CreateOleObject('Shell.Application');
ZipFile := Shell.NameSpace(ZipPath);
if VarIsClear(ZipFile) then
RaiseException(Format('Cannot open ZIP file "%s" or does not exist', [ZipPath]));
Item := ZipFile.ParseName(FileName);
if VarIsClear(Item) then
RaiseException(Format('Cannot find "%s" in "%s" ZIP file', [FileName, ZipPath]));
TargetFolder := Shell.NameSpace(TargetPath);
if VarIsClear(TargetFolder) then
RaiseException(Format('Target path "%s" does not exist', [TargetPath]));
TargetFolder.CopyHere(Item, NO_PROGRESS_BOX or RESPOND_YES_TO_ALL);
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
if CurPageID = wpReady then begin
DownloadPage.Clear;
// Use AddEx to specify a username and password
DownloadPage.Add('https://font.download/dl/font/eurostile-2.zip', 'eurostile-font.zip', '');
DownloadPage.Show;
try
try
DownloadPage.Download; // This downloads the files to {tmp}
UnZip(ExpandConstant('{tmp}\eurostile-font.zip'), 'eurostile.TTF', ExpandConstant('{tmp}'));
Result := True;
except
if DownloadPage.AbortedByUser then
Log('Aborted by user.')
else
SuppressibleMsgBox(AddPeriod(GetExceptionMessage), mbCriticalError, MB_OK, IDOK);
Result := False;
end;
finally
DownloadPage.Hide;
end;
end else
Result := True;
end;
Binary file added Installer/eurostile.TTF
Binary file not shown.

0 comments on commit e204c24

Please sign in to comment.