templates/windows/installer: Enable split binary and data installation

This is not something InnoSetup is designed for, but hey, it does work!
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2022-09-17 09:55:28 +02:00
parent 63540faf3d
commit 12c9fe51fb
1 changed files with 31 additions and 18 deletions

View File

@ -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;
// ------------------------------------------------------------------------------------------------------------------ //