2018-09-25 23:17:08 +00:00
|
|
|
; Script generated by the Inno Setup Script Wizard.
|
|
|
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
|
|
|
|
2018-12-23 19:49:18 +00:00
|
|
|
#define MyAppName "@PROJECT_FULL_NAME@"
|
2020-12-04 05:46:31 +00:00
|
|
|
#define MyAppVersion "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@.@VERSION_TWEAK@"
|
|
|
|
#define MyAppVersionText "@VERSION_STRING@"
|
2018-09-25 23:17:08 +00:00
|
|
|
#define MyAppPublisher "Xaymars Technology Workshop"
|
2020-12-04 05:46:31 +00:00
|
|
|
#define MyAppURL "https://xaymar.com/"
|
|
|
|
#define MyAppCopyright "@PROJECT_COPYRIGHT_YEARS@ @PROJECT_AUTHORS@"
|
2018-09-25 23:17:08 +00:00
|
|
|
|
|
|
|
[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.)
|
2020-07-15 16:07:09 +00:00
|
|
|
|
2020-09-29 03:39:20 +00:00
|
|
|
; Application Information
|
2018-12-23 19:49:18 +00:00
|
|
|
AppId={{DE56A03A-C8A4-474B-83B0-CFD270262D38}}
|
2018-09-25 23:17:08 +00:00
|
|
|
AppName={#MyAppName}
|
|
|
|
AppVersion={#MyAppVersion}
|
|
|
|
AppPublisher={#MyAppPublisher}
|
|
|
|
AppPublisherURL={#MyAppURL}
|
|
|
|
AppSupportURL={#MyAppURL}
|
|
|
|
AppUpdatesURL={#MyAppURL}
|
2020-07-15 16:07:09 +00:00
|
|
|
AppMutex={#MyAppName}
|
2020-09-29 03:39:20 +00:00
|
|
|
|
|
|
|
; Versioning
|
2020-12-04 05:46:31 +00:00
|
|
|
VersionInfoProductName={#MyAppName}
|
|
|
|
VersionInfoProductVersion={#MyAppVersion}
|
2020-07-15 16:07:09 +00:00
|
|
|
VersionInfoVersion={#MyAppVersion}
|
2020-12-04 05:46:31 +00:00
|
|
|
VersionInfoProductTextVersion={#MyAppVersionText}
|
|
|
|
VersionInfoTextVersion={#MyAppVersionText}
|
2020-07-15 16:07:09 +00:00
|
|
|
VersionInfoCompany={#MyAppPublisher}
|
2020-12-04 05:46:31 +00:00
|
|
|
VersionInfoCopyright={#MyAppCopyright}
|
2020-07-15 16:07:09 +00:00
|
|
|
VersionInfoDescription={#MyAppName} Setup
|
2020-09-29 03:39:20 +00:00
|
|
|
|
|
|
|
; Architecture (Platform is always Windows)
|
2020-12-04 05:46:31 +00:00
|
|
|
ArchitecturesInstallIn64BitMode=x64 arm64 ia64
|
2020-09-29 03:39:20 +00:00
|
|
|
ArchitecturesAllowed=@ARCH@
|
|
|
|
|
|
|
|
; Wizard Information
|
|
|
|
WizardStyle=modern
|
|
|
|
WizardResizable=yes
|
|
|
|
SetupIconFile="@PROJECT_SOURCE_DIR@/media/icon.ico"
|
|
|
|
|
2020-07-15 16:07:09 +00:00
|
|
|
; Other Information
|
2020-12-04 05:46:31 +00:00
|
|
|
UsePreviousAppDir=yes
|
|
|
|
DefaultDirName={code:GetDefaultDirectory}
|
2018-09-25 23:17:08 +00:00
|
|
|
DefaultGroupName={#MyAppName}
|
|
|
|
AllowNoIcons=yes
|
2019-12-22 05:26:28 +00:00
|
|
|
LicenseFile="@ISS_SOURCE_DIR@/LICENSE"
|
|
|
|
OutputDir="@ISS_PACKAGE_DIR@"
|
|
|
|
OutputBaseFilename=@CMAKE_PACKAGE_NAME@-@_PACKAGE_SUFFIX_OVERRIDE@
|
2020-09-29 03:39:20 +00:00
|
|
|
Compression=lzma2/ultra64
|
|
|
|
SolidCompression=yes
|
|
|
|
LZMAAlgorithm=1
|
2018-09-25 23:17:08 +00:00
|
|
|
|
|
|
|
[Languages]
|
|
|
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
|
|
|
|
|
|
|
[Files]
|
2019-12-22 05:26:28 +00:00
|
|
|
Source: "@ISS_FILES_DIR@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
2020-12-04 05:46:31 +00:00
|
|
|
Source: "@PROJECT_SOURCE_DIR@/templates/msvc-redist-helper.exe"; DestDir: "{app}"; DestName: "msvc-redist-helper.exe"; Flags: ignoreversion dontcopy noencryption
|
2018-09-25 23:17:08 +00:00
|
|
|
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
|
|
|
|
|
|
|
[Icons]
|
|
|
|
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
|
|
|
|
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
|
|
|
|
|
|
|
|
[Code]
|
2020-12-04 05:46:31 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
|
|
function FindRegistryKey(): String;
|
|
|
|
begin
|
|
|
|
Result := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting('AppId')}_is1');
|
|
|
|
end;
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
|
|
function GetDefaultDirectory(Value: String): String;
|
2018-09-25 23:17:08 +00:00
|
|
|
var
|
2020-12-04 05:46:31 +00:00
|
|
|
sInstallPath: String;
|
2018-09-25 23:17:08 +00:00
|
|
|
begin
|
2020-12-04 05:46:31 +00:00
|
|
|
// 1. Use the path we were given on call.
|
|
|
|
sInstallPath := Value;
|
|
|
|
|
|
|
|
// 2. If that was empty, try and find it ourselves from the registry.
|
|
|
|
if (sInstallPath = '') then
|
|
|
|
RegQueryStringValue(HKA64, FindRegistryKey(), 'InstallLocation', sInstallPath);
|
|
|
|
|
|
|
|
// 2. If empty, try and find the "Local Machine" installation of OBS Studio.
|
|
|
|
if (sInstallPath = '') then
|
|
|
|
RegQueryStringValue(HKLM64, 'SOFTWARE\OBS Studio', '', sInstallPath);
|
|
|
|
|
|
|
|
// 3. If empty, try and find the "Current User" installation of OBS Studio.
|
|
|
|
if (sInstallPath = '') then
|
|
|
|
RegQueryStringValue(HKCU64, 'SOFTWARE\OBS Studio', '', sInstallPath);
|
|
|
|
|
|
|
|
// 4. If empty, try and find the 32-bit "Local Machine" installation of OBS Studio.
|
|
|
|
if (sInstallPath = '') then
|
|
|
|
RegQueryStringValue(HKLM32, 'SOFTWARE\OBS Studio', '', sInstallPath);
|
|
|
|
|
|
|
|
// 5. If empty, try and find the 32-bit "Current User" installation of OBS Studio.
|
|
|
|
if (sInstallPath = '') then
|
|
|
|
RegQueryStringValue(HKCU32, 'SOFTWARE\OBS Studio', '', sInstallPath);
|
|
|
|
|
|
|
|
// 6. If empty, just use the default path.
|
|
|
|
if (sInstallPath = '') then
|
|
|
|
sInstallPath := ExpandConstant('{commonpf}\obs-studio');
|
|
|
|
|
|
|
|
Result := sInstallPath
|
2018-09-25 23:17:08 +00:00
|
|
|
end;
|
|
|
|
|
2020-12-04 05:46:31 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
|
|
function GetUninstallerPath(): String;
|
2018-09-25 23:17:08 +00:00
|
|
|
var
|
2020-12-04 05:46:31 +00:00
|
|
|
sRegistryKey: String;
|
|
|
|
sUninstallerPath: String;
|
2018-09-25 23:17:08 +00:00
|
|
|
begin
|
2020-12-04 05:46:31 +00:00
|
|
|
sRegistryKey := FindRegistryKey();
|
|
|
|
|
|
|
|
RegQueryStringValue(HKLM64, sRegistryKey, 'UninstallString', sUninstallerPath);
|
|
|
|
|
|
|
|
if (sUninstallerPath = '') then
|
|
|
|
RegQueryStringValue(HKCU64, sRegistryKey, 'UninstallString', sUninstallerPath);
|
|
|
|
|
|
|
|
if (sUninstallerPath = '') then
|
|
|
|
RegQueryStringValue(HKLM32, sRegistryKey, 'UninstallString', sUninstallerPath);
|
|
|
|
|
|
|
|
if (sUninstallerPath = '') then
|
|
|
|
RegQueryStringValue(HKCU32, sRegistryKey, 'UninstallString', sUninstallerPath);
|
|
|
|
|
|
|
|
Result := sUninstallerPath;
|
2018-09-25 23:17:08 +00:00
|
|
|
end;
|
|
|
|
|
2020-12-04 05:46:31 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------------------------ //
|
2018-09-25 23:17:08 +00:00
|
|
|
function IsUpgrade(): Boolean;
|
|
|
|
begin
|
2020-12-04 05:46:31 +00:00
|
|
|
Result := (GetUninstallerPath() <> '');
|
2018-09-25 23:17:08 +00:00
|
|
|
end;
|
|
|
|
|
2020-12-04 05:46:31 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
|
|
function UninstallOldVersion(): Integer;
|
2018-09-25 23:17:08 +00:00
|
|
|
var
|
2020-12-04 05:46:31 +00:00
|
|
|
sUninstallerPath: String;
|
|
|
|
iResultCode: Integer;
|
2018-09-25 23:17:08 +00:00
|
|
|
begin
|
2020-12-04 05:46:31 +00:00
|
|
|
Result := 0;
|
|
|
|
sUninstallerPath := GetUninstallerPath();
|
|
|
|
if (sUninstallerPath <> '') then begin
|
|
|
|
sUninstallerPath := RemoveQuotes(sUninstallerPath);
|
|
|
|
if Exec(sUninstallerPath, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES', '', SW_HIDE, ewWaitUntilTerminated, iResultCode) then begin
|
|
|
|
Result := iResultCode
|
|
|
|
end else begin
|
|
|
|
Result := 1
|
|
|
|
end;
|
|
|
|
end;
|
2018-09-25 23:17:08 +00:00
|
|
|
end;
|
|
|
|
|
2020-12-04 05:46:31 +00:00
|
|
|
// ------------------------------------------------------------------------------------------------------------------ //
|
|
|
|
function PrepareToInstall(var NeedsRestart: Boolean): String;
|
2020-07-15 16:07:09 +00:00
|
|
|
var
|
2020-12-04 05:46:31 +00:00
|
|
|
iResultCode: Integer;
|
2018-09-25 23:17:08 +00:00
|
|
|
begin
|
2020-12-04 05:46:31 +00:00
|
|
|
// Attempt to remove old version if it exists.
|
|
|
|
if (IsUpgrade()) then begin
|
|
|
|
UninstallOldVersion();
|
|
|
|
end;
|
|
|
|
|
|
|
|
// Also ensure that we have the necessary prerequisites installed to run the program.
|
2020-07-15 16:07:09 +00:00
|
|
|
ExtractTemporaryFile('msvc-redist-helper.exe');
|
2020-12-04 05:46:31 +00:00
|
|
|
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, iResultCode);
|
2019-10-13 03:43:45 +00:00
|
|
|
end;
|