forked from Aitum/obs-vertical-canvas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer.iss.in
144 lines (129 loc) · 4.65 KB
/
installer.iss.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "@PROJECT_FULL_NAME@"
#define MyAppVersion "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@"
#define MyAppPublisher "Aitum"
[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.)
; app Information
AppId={{9072EA15-785B-4BD9-8310-68CEECDA2117}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppMutex={#MyAppName}
VersionInfoVersion={#MyAppVersion}
VersionInfoCompany={#MyAppPublisher}
VersionInfoDescription={#MyAppName} Setup
; Compression
Compression=lzma2/ultra64
SolidCompression=yes
LZMAAlgorithm=1
; Other Information
DefaultDirName={code:GetDirName}
AppendDefaultDirName=no
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
OutputDir="package"
OutputBaseFilename=@PROJECT_NAME@-installer
DirExistsWarning=no
DisableDirPage=no
; Wizard Information
WizardStyle=modern
WizardResizable=yes
SetupIconFile="media/icon.ico"
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Files]
Source: "package/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
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 := ExpandConstant('{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;
if RegQueryStringValue(HKLM64, '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, '/VERYSILENT /NORESTART /SUPPRESSMSGBOXES','', SW_HIDE, ewWaitUntilTerminated, iResultCode) then
Result := 3
else
Result := 2;
end else
Result := 1;
end;
/////////////////////////////////////////////////////////////////////
function NextButtonClick(PageId: Integer): Boolean;
var
ObsFileName: string;
ObsMS, ObsLS: Cardinal;
ObsMajorVersion, ObsMinorVersion: Cardinal;
begin
Result := True;
if not (PageId = wpSelectDir) then begin
exit;
end;
ObsFileName := ExpandConstant('{app}\bin\64bit\obs64.exe');
if not FileExists(ObsFileName) then begin
MsgBox('OBS Studio (bin\64bit\obs64.exe) does not seem to be installed in that folder. Please select the correct folder.', mbError, MB_OK);
Result := False;
exit;
end;
Result := GetVersionNumbers(ObsFileName, ObsMS, ObsLS);
if not Result then begin
MsgBox('Failed to read version from OBS Studio (bin\64bit\obs64.exe).', mbError, MB_OK);
Result := False;
exit;
end;
{ shift 16 bits to the right to get major version }
ObsMajorVersion := ObsMS shr 16;
{ select only low 16 bits }
ObsMinorVersion := ObsMS and $FFFF;
if ObsMajorVersion < 29 then begin
MsgBox('Version of OBS Studio (bin\64bit\obs64.exe) is lower than the version 29 required.', mbError, MB_OK);
Result := False;
exit;
end;
end;