From 12c9fe51fb81a08a7be0cc7eae628e30a4660c21 Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sat, 17 Sep 2022 09:55:28 +0200 Subject: [PATCH] templates/windows/installer: Enable split binary and data installation This is not something InnoSetup is designed for, but hey, it does work! --- templates/windows/installer.iss.in | 49 +++++++++++++++++++----------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/templates/windows/installer.iss.in b/templates/windows/installer.iss.in index 0ecc47c6..f241137d 100644 --- a/templates/windows/installer.iss.in +++ b/templates/windows/installer.iss.in @@ -73,7 +73,8 @@ LZMAAlgorithm=1 Name: "english"; MessagesFile: "compiler:Default.isl" [Files] -Source: "@ISS_FILES_DIR@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "@ISS_FILES_DIR@/data/obs-plugins/@PROJECT_NAME@/*"; DestDir: "{code:GetOutputDataDir}"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "@ISS_FILES_DIR@/obs-plugins/@D_PLATFORM_BITS@bit/*"; DestDir: "{code:GetOutputBinaryDir}"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "@PROJECT_SOURCE_DIR@/templates/windows/msvc-redist-helper.exe"; DestDir: "{app}"; DestName: "msvc-redist-helper.exe"; Flags: ignoreversion dontcopy noencryption ; NOTE: Don't use "Flags: ignoreversion" on any shared system files @@ -92,6 +93,8 @@ procedure InitializeWizard; forward; function ShouldSkipPage(PageID: Integer): Boolean; forward; function PrepareToInstall(var NeedsRestart: Boolean): String; forward; function GetDefaultDirectory(Value: String): String; forward; +function GetOutputBinaryDir(Value: String): String; forward; +function GetOutputDataDir(Value: String): String; forward; // Which installation mode is selected? function IsPortablePagePortableChoiceChecked(): Boolean; forward; @@ -140,28 +143,38 @@ end; // ------------------------------------------------------------------------------------------------------------------ // function GetDefaultDirectory(Value: String): String; var - sInstallPath: String; + sPath: String; begin - // 1. Use the path we were given on call. - sInstallPath := Value; + // Otherwise, try and figure out where the previous installation of the same type went to. + if (RegQueryStringValue(HKA64, FindRegistryKey(), 'InstallLocation', sPath)) then begin + Result := sPath; + exit; + end; - // 2. If that was empty, try and find it ourselves from the registry. - if (sInstallPath = '') then - RegQueryStringValue(HKA64, FindRegistryKey(), 'InstallLocation', sInstallPath); + // Install to OBS Studio by default. + if (RegQueryStringValue(HKLM64, 'SOFTWARE\OBS Studio', '', sPath)) then begin + Result := sPath; + exit; + end; - // 2. If empty, try and find the "Local Machine" installation of OBS Studio. - if (sInstallPath = '') then - RegQueryStringValue(HKLM64, 'SOFTWARE\OBS Studio', '', sInstallPath); + exit; +end; - // 3. If empty, try and find the "Current User" installation of OBS Studio. - if (sInstallPath = '') then - RegQueryStringValue(HKCU64, 'SOFTWARE\OBS Studio', '', sInstallPath); +// ------------------------------------------------------------------------------------------------------------------ // +function GetOutputBinaryDir(Value: String): String; +var + sPath: String; +begin + sPath := ExpandConstant('{app}\obs-plugins\@D_PLATFORM_BITS@bit\'); + Result := sPath; +end; - // 6. If empty, just use the default path. - if (sInstallPath = '') then - sInstallPath := ExpandConstant('{commonpf}\obs-studio'); - - Result := sInstallPath +function GetOutputDataDir(Value: String): String; +var + sPath: String; +begin + sPath := ExpandConstant('{app}\data\obs-plugins\@PROJECT_NAME@\'); + Result := sPath; end; // ------------------------------------------------------------------------------------------------------------------ //