166 lines
7.2 KiB
Plaintext
166 lines
7.2 KiB
Plaintext
#define MyAppName "Lite XL"
|
|
#define MyAppVersion "@PROJECT_VERSION@"
|
|
#define MyAppPublisher "Lite XL Team"
|
|
#define MyAppURL "https://lite-xl.com"
|
|
#define MyAppExeName "lite-xl.exe"
|
|
#define BuildDir "@PROJECT_BUILD_DIR@"
|
|
#define SourceDir "@PROJECT_SOURCE_DIR@"
|
|
|
|
; Use /dArch option to create a setup for a different architecture, e.g.:
|
|
; iscc /dArch=x86 innosetup.iss
|
|
#ifndef Arch
|
|
#define Arch "x64"
|
|
#endif
|
|
|
|
[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 InnoSetup IDE.
|
|
AppId={{06761240-D97C-43DE-B9ED-C15F765A2D65}
|
|
|
|
AppName={#MyAppName}
|
|
AppVersion={#MyAppVersion}
|
|
;AppVerName={#MyAppName} {#MyAppVersion}
|
|
AppPublisher={#MyAppPublisher}
|
|
AppPublisherURL={#MyAppURL}
|
|
AppSupportURL={#MyAppURL}
|
|
AppUpdatesURL={#MyAppURL}
|
|
|
|
#if Arch=="x86"
|
|
#define ArchInternal "i686"
|
|
#else
|
|
ArchitecturesAllowed={#Arch}
|
|
ArchitecturesInstallIn64BitMode={#Arch}
|
|
#if Arch=="x64"
|
|
#define ArchInternal "x86_64"
|
|
#elif Arch=="arm64"
|
|
#define ArchInternal "aarch64"
|
|
#endif
|
|
#endif
|
|
|
|
AllowNoIcons=yes
|
|
Compression=lzma
|
|
SolidCompression=yes
|
|
DefaultDirName={autopf}/{#MyAppName}
|
|
DefaultGroupName={#MyAppPublisher}
|
|
UninstallFilesDir={app}
|
|
|
|
; Uncomment the following line to run in non administrative install mode
|
|
; (install for current user only.)
|
|
;PrivilegesRequired=lowest
|
|
PrivilegesRequiredOverridesAllowed=dialog
|
|
|
|
; The [Icons] "quicklaunchicon" entry uses {userappdata}
|
|
; but its [Tasks] entry has a proper IsAdminInstallMode Check.
|
|
UsedUserAreasWarning=no
|
|
|
|
OutputDir=.
|
|
OutputBaseFilename=LiteXL-{#MyAppVersion}-{#ArchInternal}-setup
|
|
;DisableDirPage=yes
|
|
;DisableProgramGroupPage=yes
|
|
|
|
LicenseFile={#SourceDir}/LICENSE
|
|
SetupIconFile={#SourceDir}/resources/icons/icon.ico
|
|
UninstallDisplayIcon={app}\{#MyAppExeName}, 0
|
|
WizardImageFile="{#SourceDir}/scripts/innosetup/wizard-modern-image.bmp"
|
|
WizardSmallImageFile="{#SourceDir}/scripts/innosetup/litexl-55px.bmp"
|
|
|
|
; Required for the add to path option to refresh environment
|
|
ChangesEnvironment=yes
|
|
|
|
[Languages]
|
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
|
|
|
[Tasks]
|
|
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
|
|
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 6.1; Check: not IsAdminInstallMode
|
|
Name: "portablemode"; Description: "Portable Mode"; Flags: unchecked
|
|
Name: "envPath"; Description: "Add lite-xl to the PATH variable, allowing it to be run from a command line."
|
|
|
|
[Files]
|
|
Source: "{#BuildDir}/lite-xl/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
|
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
|
|
|
[Icons]
|
|
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
|
|
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Check: not WizardIsTaskSelected('portablemode')
|
|
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"; Check: not WizardIsTaskSelected('portablemode')
|
|
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon; Check: not WizardIsTaskSelected('portablemode')
|
|
; Name: "{usersendto}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
|
|
|
[Registry]
|
|
Root: "HKA"; Subkey: "Software\Classes\*\shell\{#MyAppName}"; ValueType: string; ValueName: ""; ValueData: "Open with {#MyAppName}"; Flags: uninsdeletekey
|
|
Root: "HKA"; Subkey: "Software\Classes\*\shell\{#MyAppName}"; ValueType: string; ValueName: "Icon"; ValueData: "{app}\{#MyAppExeName}, 0"; Flags: uninsdeletekey
|
|
Root: "HKA"; Subkey: "Software\Classes\*\shell\{#MyAppName}\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExename}"" ""%1"""; Flags: uninsdeletekey
|
|
Root: "HKA"; Subkey: "Software\Classes\directory\shell\{#MyAppName}"; ValueType: string; ValueName: ""; ValueData: "Open with {#MyAppName}"; Flags: uninsdeletekey
|
|
Root: "HKA"; Subkey: "Software\Classes\directory\shell\{#MyAppName}"; ValueType: string; ValueName: "Icon"; ValueData: "{app}\{#MyAppExeName}, 0"; Flags: uninsdeletekey
|
|
Root: "HKA"; Subkey: "Software\Classes\directory\shell\{#MyAppName}\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExename}"" ""%1"""; Flags: uninsdeletekey
|
|
Root: "HKA"; Subkey: "Software\Classes\directory\background\shell\{#MyAppName}"; ValueType: string; ValueName: ""; ValueData: "Open with {#MyAppName}"; Flags: uninsdeletekey
|
|
Root: "HKA"; Subkey: "Software\Classes\directory\background\shell\{#MyAppName}"; ValueType: string; ValueName: "Icon"; ValueData: "{app}\{#MyAppExeName}, 0"; Flags: uninsdeletekey
|
|
Root: "HKA"; Subkey: "Software\Classes\directory\background\shell\{#MyAppName}\command"; ValueType: string; ValueName: ""; ValueData: """{app}\{#MyAppExename}"" ""%V"""; Flags: uninsdeletekey
|
|
|
|
[Run]
|
|
Filename: "{app}/{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
|
|
|
|
[Setup]
|
|
Uninstallable=not WizardIsTaskSelected('portablemode')
|
|
|
|
; Code to add installation path to environment taken from:
|
|
; https://stackoverflow.com/a/46609047
|
|
[Code]
|
|
const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
|
|
|
|
procedure EnvAddPath(Path: string);
|
|
var
|
|
Paths: string;
|
|
begin
|
|
{ Retrieve current path (use empty string if entry not exists) }
|
|
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
|
|
then Paths := '';
|
|
|
|
{ Skip if string already found in path }
|
|
if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit;
|
|
|
|
{ App string to the end of the path variable }
|
|
Paths := Paths + ';'+ Path +';'
|
|
|
|
{ Overwrite (or create if missing) path environment variable }
|
|
if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
|
|
then Log(Format('The [%s] added to PATH: [%s]', [Path, Paths]))
|
|
else Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths]));
|
|
end;
|
|
|
|
procedure EnvRemovePath(Path: string);
|
|
var
|
|
Paths: string;
|
|
P: Integer;
|
|
begin
|
|
{ Skip if registry entry not exists }
|
|
if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then
|
|
exit;
|
|
|
|
{ Skip if string not found in path }
|
|
P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';');
|
|
if P = 0 then exit;
|
|
|
|
{ Update path variable }
|
|
Delete(Paths, P - 1, Length(Path) + 1);
|
|
|
|
{ Overwrite path environment variable }
|
|
if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths)
|
|
then Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths]))
|
|
else Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths]));
|
|
end;
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
|
begin
|
|
if (CurStep = ssPostInstall) and WizardIsTaskSelected('envPath')
|
|
then EnvAddPath(ExpandConstant('{app}'));
|
|
end;
|
|
|
|
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
|
|
begin
|
|
if CurUninstallStep = usPostUninstall
|
|
then EnvRemovePath(ExpandConstant('{app}'));
|
|
end;
|