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.)
|
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}
|
|
|
|
;AppVerName={#MyAppName} {#MyAppVersion}
|
|
|
|
AppPublisher={#MyAppPublisher}
|
|
|
|
AppPublisherURL={#MyAppURL}
|
|
|
|
AppSupportURL={#MyAppURL}
|
|
|
|
AppUpdatesURL={#MyAppURL}
|
|
|
|
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@
|
2018-09-25 23:17:08 +00:00
|
|
|
Compression=lzma
|
|
|
|
SolidCompression=yes
|
|
|
|
VersionInfoVersion={#MyAppVersion}
|
|
|
|
VersionInfoCompany={#MyAppPublisher}
|
|
|
|
VersionInfoDescription={#MyAppName} Setup
|
|
|
|
|
|
|
|
[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
|
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
|
|
|
|
Result := '{pf}\obs-studio';
|
|
|
|
// 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);
|
|
|
|
if Exec(sUnInstallString, '/SILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
|
|
|
|
Result := 3
|
|
|
|
else
|
|
|
|
Result := 2;
|
|
|
|
end else
|
|
|
|
Result := 1;
|
|
|
|
end;
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
|
|
|
begin
|
|
|
|
if (CurStep=ssInstall) then
|
|
|
|
begin
|
|
|
|
if (IsUpgrade()) then
|
|
|
|
begin
|
|
|
|
UnInstallOldVersion();
|
|
|
|
end;
|
|
|
|
end;
|
2019-10-13 03:43:45 +00:00
|
|
|
end;
|