mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-08-25 18:55:30 -05:00
Don't reuse the old installation dir since it might not be compatible with the new layout. Ensure previous legacy install is cleaned up to avoid plugin being installed twice.
87 lines
3.1 KiB
Plaintext
87 lines
3.1 KiB
Plaintext
#define MyAppName "@CMAKE_PROJECT_NAME@"
|
|
#define MyAppVersion "@CMAKE_PROJECT_VERSION@"
|
|
#define MyAppPublisher "@PLUGIN_AUTHOR@"
|
|
#define MyAppURL "@PLUGIN_WEBSITE@"
|
|
#define MyAppId "@UUID_APP@"
|
|
|
|
[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={{{#MyAppId}}
|
|
AppName={#MyAppName}
|
|
AppVersion={#MyAppVersion}
|
|
AppPublisher={#MyAppPublisher}
|
|
AppPublisherURL={#MyAppURL}
|
|
AppSupportURL={#MyAppURL}
|
|
AppUpdatesURL={#MyAppURL}
|
|
DefaultDirName={code:GetDirName}
|
|
DefaultGroupName={#MyAppName}
|
|
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Windows-Installer
|
|
Compression=lzma
|
|
SolidCompression=yes
|
|
DirExistsWarning=no
|
|
UsePreviousAppDir=no
|
|
SetupIconFile=installer.ico
|
|
UninstallDisplayIcon={app}\advanced-scene-switcher\data\res\images\logo.ico
|
|
DisableDirPage=no
|
|
|
|
[Languages]
|
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
|
|
|
[Files]
|
|
Source: "..\release\Package\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
|
Source: "..\LICENSE"; Flags: dontcopy
|
|
; 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]
|
|
procedure InitializeWizard();
|
|
var
|
|
GPLText: AnsiString;
|
|
Page: TOutputMsgMemoWizardPage;
|
|
begin
|
|
ExtractTemporaryFile('LICENSE');
|
|
LoadStringFromFile(ExpandConstant('{tmp}\LICENSE'), GPLText);
|
|
Page := CreateOutputMsgMemoPage(wpWelcome,
|
|
'License Information', 'Please review the license terms before installing {#MyAppName}',
|
|
'Press Page Down to see the rest of the agreement. Once you are aware of your rights, click Next to continue.',
|
|
String(GPLText)
|
|
);
|
|
end;
|
|
|
|
function GetDirName(Value: string): string;
|
|
begin
|
|
Result := ExpandConstant('{commonappdata}\obs-studio\plugins');
|
|
end;
|
|
|
|
// Remove files placed by the legacy installer (obs-plugins/64bit and
|
|
// data/obs-plugins layout) so the plugin is not loaded twice by OBS.
|
|
// We read InstallLocation from our own previous uninstall entry, which is
|
|
// the exact directory the old installer used regardless of OBS install path.
|
|
procedure RemoveLegacyFiles();
|
|
var
|
|
OldInstallPath: string;
|
|
UninstallKey: string;
|
|
begin
|
|
UninstallKey := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + '{' + '{#MyAppId}' + '}_is1';
|
|
if not RegQueryStringValue(HKLM, UninstallKey, 'InstallLocation', OldInstallPath) then
|
|
Exit;
|
|
DeleteFile(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher.dll');
|
|
DeleteFile(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher.pdb');
|
|
DeleteFile(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher-lib.dll');
|
|
DeleteFile(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher-lib.pdb');
|
|
DelTree(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher-plugins', True, True, True);
|
|
DelTree(OldInstallPath + '\data\obs-plugins\advanced-scene-switcher', True, True, True);
|
|
end;
|
|
|
|
procedure CurStepChanged(CurStep: TSetupStep);
|
|
begin
|
|
if CurStep = ssInstall then
|
|
RemoveLegacyFiles();
|
|
end;
|
|
|