22#define MyAppVersion "@CMAKE_PROJECT_VERSION@"
33#define MyAppPublisher "@PLUGIN_AUTHOR@"
44#define MyAppURL "@PLUGIN_WEBSITE@"
5+ #define MyAppId "@UUID_APP@"
56
67[Setup]
78; NOTE: The value of AppId uniquely identifies this application.
89; Do not use the same AppId value in installers for other applications.
910; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
10- AppId={{@UUID_APP@ }
11+ AppId={{{#MyAppId} }
1112AppName={#MyAppName}
1213AppVersion={#MyAppVersion}
1314AppPublisher={#MyAppPublisher}
@@ -20,6 +21,7 @@ OutputBaseFilename={#MyAppName}-{#MyAppVersion}-Windows-Installer
2021Compression=lzma
2122SolidCompression=yes
2223DirExistsWarning=no
24+ UsePreviousAppDir=no
2325SetupIconFile=installer.ico
2426UninstallDisplayIcon={app}\advanced-scene-switcher\data\res\images\logo.ico
2527DisableDirPage=no
@@ -51,10 +53,34 @@ begin
5153 );
5254end;
5355
54- // credit where it's due :
55- // following function come from https://github.com/Xaymar/obs-studio_amf-encoder-plugin/blob/master/%23Resources/Installer.in.iss#L45
5656function GetDirName(Value: string): string;
5757begin
5858 Result := ExpandConstant('{commonappdata}\obs-studio\plugins');
5959end;
6060
61+ // Remove files placed by the legacy installer (obs-plugins/64bit and
62+ // data/obs-plugins layout) so the plugin is not loaded twice by OBS.
63+ // We read InstallLocation from our own previous uninstall entry, which is
64+ // the exact directory the old installer used regardless of OBS install path.
65+ procedure RemoveLegacyFiles();
66+ var
67+ OldInstallPath: string;
68+ UninstallKey: string;
69+ begin
70+ UninstallKey := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' + '{' + '{#MyAppId}' + '}_is1';
71+ if not RegQueryStringValue(HKLM, UninstallKey, 'InstallLocation', OldInstallPath) then
72+ Exit;
73+ DeleteFile(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher.dll');
74+ DeleteFile(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher.pdb');
75+ DeleteFile(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher-lib.dll');
76+ DeleteFile(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher-lib.pdb');
77+ DelTree(OldInstallPath + '\obs-plugins\64bit\advanced-scene-switcher-plugins', True, True, True);
78+ DelTree(OldInstallPath + '\data\obs-plugins\advanced-scene-switcher', True, True, True);
79+ end;
80+
81+ procedure CurStepChanged(CurStep: TSetupStep);
82+ begin
83+ if CurStep = ssInstall then
84+ RemoveLegacyFiles();
85+ end;
86+
0 commit comments