-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add experimental Windows installer
- Loading branch information
1 parent
9caffc9
commit 83aab64
Showing
3 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
; Script generated by the Inno Setup Script Wizard. | ||
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! | ||
|
||
#define MyAppName "libdragon" | ||
#define MyAppVersion "none" | ||
#define MyAppPublisher "Libdragon" | ||
#define MyAppURL "https://libdragon.dev/" | ||
#define MyAppExeName "libdragon.exe" | ||
|
||
[Setup] | ||
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. | ||
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.) | ||
AppId={{B9EE00C4-986A-4E99-BE51-2730EFB899FF} | ||
AppName={#MyAppName} | ||
AppVersion={#MyAppVersion} | ||
;AppVerName={#MyAppName} {#MyAppVersion} | ||
AppPublisher={#MyAppPublisher} | ||
AppPublisherURL={#MyAppURL} | ||
AppSupportURL={#MyAppURL} | ||
AppUpdatesURL={#MyAppURL} | ||
DefaultDirName={autopf}\{#MyAppName} | ||
DefaultGroupName={#MyAppName} | ||
DisableProgramGroupPage=yes | ||
LicenseFile=.\LICENSE.md | ||
OutputBaseFilename=libdragon-installer | ||
Compression=lzma | ||
SolidCompression=yes | ||
WizardStyle=modern | ||
ChangesEnvironment=yes | ||
; TODO: It is possible to enable this if the executable itself does the | ||
; PrivilegesRequiredOverridesAllowed=dialog | ||
|
||
[Languages] | ||
Name: "english"; MessagesFile: "compiler:Default.isl" | ||
|
||
[Files] | ||
Source: ".\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion | ||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files | ||
|
||
[Icons] | ||
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}" | ||
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" | ||
|
||
[Registry] | ||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \ | ||
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; \ | ||
Check: NeedsAddPath(ExpandConstant('{app}')) | ||
|
||
[Code] | ||
const | ||
EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; | ||
function NeedsAddPath(Param: string): boolean; | ||
var | ||
OrigPath: string; | ||
begin | ||
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, | ||
EnvironmentKey, | ||
'Path', OrigPath) | ||
then begin | ||
Result := True; | ||
exit; | ||
end; | ||
{ look for the path with leading and trailing semicolon } | ||
{ Pos() returns 0 if not found } | ||
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0; | ||
end; | ||
procedure RemovePath(Path: string); | ||
var | ||
Paths: string; | ||
P: Integer; | ||
begin | ||
if not RegQueryStringValue(HKLM, EnvironmentKey, 'Path', Paths) then begin | ||
Log('PATH not found'); | ||
end else begin | ||
Log(Format('PATH is [%s]', [Paths])); | ||
P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';'); | ||
if P = 0 then begin | ||
Log(Format('Path [%s] not found in PATH', [Path])); | ||
end else begin | ||
if P > 1 then P := P - 1; | ||
Delete(Paths, P, Length(Path) + 1); | ||
Log(Format('Path [%s] removed from PATH => [%s]', [Path, Paths])); | ||
if RegWriteStringValue(HKLM, EnvironmentKey, 'Path', Paths) then begin | ||
Log('PATH written'); | ||
end | ||
end | ||
end | ||
end; | ||
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); | ||
begin | ||
if CurUninstallStep = usUninstall then | ||
begin | ||
RemovePath(ExpandConstant('{app}')); | ||
end; | ||
end; |