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@"
|
2018-09-25 23:17:08 +00:00
|
|
|
#define MyAppVersion "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.@PROJECT_VERSION_TWEAK@"
|
|
|
|
#define MyAppPublisher "Xaymars Technology Workshop"
|
2018-12-23 19:49:18 +00:00
|
|
|
#define MyAppURL "https://www.xaymar.com/"
|
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-07-15 16:07:09 +00:00
|
|
|
VersionInfoVersion={#MyAppVersion}
|
|
|
|
VersionInfoCompany={#MyAppPublisher}
|
|
|
|
VersionInfoDescription={#MyAppName} Setup
|
2020-09-29 03:39:20 +00:00
|
|
|
|
|
|
|
; Architecture (Platform is always Windows)
|
|
|
|
ArchitecturesInstallIn64BitMode=@ARCH@
|
|
|
|
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
|
2018-09-25 23:17:08 +00:00
|
|
|
DefaultDirName={code:GetDirName}
|
|
|
|
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-07-15 16:07:09 +00:00
|
|
|
Source: "@PROJECT_SOURCE_DIR@/third-party/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]
|
|
|
|
function GetDirName(Value: string): string;
|
|
|
|
var
|
|
|
|
InstallPath: string;
|
|
|
|
begin
|
|
|
|
// initialize default path, which will be returned when the following registry
|
|
|
|
// key queries fail due to missing keys or for some different reason
|
2020-09-29 03:39:20 +00:00
|
|
|
Result := ExpandConstant('{pf}\obs-studio');
|
2018-09-25 23:17:08 +00:00
|
|
|
// query the first registry value; if this succeeds, return the obtained value
|
|
|
|
if RegQueryStringValue(HKLM32, 'SOFTWARE\OBS Studio', '', InstallPath) then
|
|
|
|
Result := InstallPath
|
|
|
|
end;
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
function GetUninstallString(): String;
|
|
|
|
var
|
|
|
|
sUnInstPath: String;
|
|
|
|
sUnInstallString: String;
|
|
|
|
begin
|
|
|
|
sUnInstPath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\{#emit SetupSetting("AppId")}_is1');
|
|
|
|
sUnInstallString := '';
|
|
|
|
if not RegQueryStringValue(HKLM, sUnInstPath, 'UninstallString', sUnInstallString) then
|
|
|
|
RegQueryStringValue(HKCU, sUnInstPath, 'UninstallString', sUnInstallString);
|
|
|
|
Result := sUnInstallString;
|
|
|
|
end;
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
function IsUpgrade(): Boolean;
|
|
|
|
begin
|
|
|
|
Result := (GetUninstallString() <> '');
|
|
|
|
end;
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
function UnInstallOldVersion(): Integer;
|
|
|
|
var
|
|
|
|
sUnInstallString: String;
|
|
|
|
iResultCode: Integer;
|
|
|
|
begin
|
|
|
|
// Return Values:
|
|
|
|
// 1 - uninstall string is empty
|
|
|
|
// 2 - error executing the UnInstallString
|
|
|
|
// 3 - successfully executed the UnInstallString
|
|
|
|
|
|
|
|
// default return value
|
|
|
|
Result := 0;
|
|
|
|
|
|
|
|
// get the uninstall string of the old app
|
|
|
|
sUnInstallString := GetUninstallString();
|
|
|
|
if sUnInstallString <> '' then begin
|
|
|
|
sUnInstallString := RemoveQuotes(sUnInstallString);
|
2020-07-15 16:07:09 +00:00
|
|
|
if Exec(sUnInstallString, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
|
2018-09-25 23:17:08 +00:00
|
|
|
Result := 3
|
|
|
|
else
|
|
|
|
Result := 2;
|
|
|
|
end else
|
|
|
|
Result := 1;
|
|
|
|
end;
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
2020-07-15 16:07:09 +00:00
|
|
|
var
|
|
|
|
ResultCode: Integer;
|
2018-09-25 23:17:08 +00:00
|
|
|
begin
|
|
|
|
if (CurStep=ssInstall) then
|
|
|
|
begin
|
|
|
|
if (IsUpgrade()) then
|
|
|
|
begin
|
|
|
|
UnInstallOldVersion();
|
|
|
|
end;
|
|
|
|
end;
|
2020-07-15 16:07:09 +00:00
|
|
|
if (CurStep=ssPostInstall) then
|
|
|
|
begin
|
|
|
|
ExtractTemporaryFile('msvc-redist-helper.exe');
|
|
|
|
Exec(ExpandConstant('{tmp}\msvc-redist-helper.exe'), '2019', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
|
|
|
|
end;
|
2019-10-13 03:43:45 +00:00
|
|
|
end;
|