-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
189 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
; Based on https://github.com/obsproject/obs-amd-encoder/blob/master/ci/installer.in.iss | ||
|
||
#define MyAppName "@CMAKE_PROJECT_NAME@" | ||
#define MyAppVersion "@CMAKE_PROJECT_VERSION@" | ||
#define MyAppPublisher "@PLUGIN_AUTHOR@" | ||
#define MyAppURL "https://github.com/bozbez/win-capture-audio" | ||
|
||
[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.) | ||
AppId={{406FD363-BC38-47EE-AF53-7F6FB4D56ECE} | ||
AppName={#MyAppName} | ||
AppVersion={#MyAppVersion} | ||
;AppVerName={#MyAppName} {#MyAppVersion} | ||
AppPublisher={#MyAppPublisher} | ||
AppPublisherURL={#MyAppURL} | ||
AppSupportURL={#MyAppURL} | ||
AppUpdatesURL={#MyAppURL} | ||
DefaultDirName={code:GetDirName} | ||
DefaultGroupName={#MyAppName} | ||
AllowNoIcons=yes | ||
LicenseFile="@PROJECT_SOURCE_DIR@/LICENSE" | ||
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-setup | ||
Compression=lzma | ||
SolidCompression=yes | ||
VersionInfoVersion={#MyAppVersion} | ||
VersionInfoCompany={#MyAppPublisher} | ||
VersionInfoDescription={#MyAppName} Setup | ||
|
||
[Languages] | ||
Name: "english"; MessagesFile: "compiler:Default.isl" | ||
|
||
[Files] | ||
Source: "@RELEASE_DIR@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs | ||
; 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; | ||
end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters