From 4cedb291235c246318141c17ab875d9ddcee3611 Mon Sep 17 00:00:00 2001 From: WarmUpTill <19472752+WarmUpTill@users.noreply.github.com> Date: Sun, 24 May 2026 21:50:34 +0200 Subject: [PATCH] Fix issues with Windows installer 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. --- .github/scripts/Package-Windows.ps1 | 1 + .../resources/installer-Windows.iss.in | 32 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/.github/scripts/Package-Windows.ps1 b/.github/scripts/Package-Windows.ps1 index 3e7dd464..55ae3688 100644 --- a/.github/scripts/Package-Windows.ps1 +++ b/.github/scripts/Package-Windows.ps1 @@ -119,6 +119,7 @@ function Package { Log-Information 'Creating InnoSetup installer...' Push-Location -Stack BuildTemp Ensure-Location -Path "${ProjectRoot}/release" + Remove-Item -Path Package -Recurse -Force -ErrorAction SilentlyContinue Copy-Item -Path ${Configuration} -Destination Package -Recurse Invoke-External iscc ${IsccFile} /O"${ProjectRoot}/release" /F"${OutputName}-Installer" Remove-Item -Path Package -Recurse diff --git a/cmake/windows/resources/installer-Windows.iss.in b/cmake/windows/resources/installer-Windows.iss.in index 656c3100..e94639d9 100644 --- a/cmake/windows/resources/installer-Windows.iss.in +++ b/cmake/windows/resources/installer-Windows.iss.in @@ -2,12 +2,13 @@ #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={{@UUID_APP@} +AppId={{{#MyAppId}} AppName={#MyAppName} AppVersion={#MyAppVersion} AppPublisher={#MyAppPublisher} @@ -20,6 +21,7 @@ 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 @@ -51,10 +53,34 @@ begin ); end; -// credit where it's due : -// following function come from https://github.com/Xaymar/obs-studio_amf-encoder-plugin/blob/master/%23Resources/Installer.in.iss#L45 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; +