diff --git a/CI/windows/setup.iss.in b/CI/windows/setup.iss.in index af0b50a9..ee42a1ac 100644 --- a/CI/windows/setup.iss.in +++ b/CI/windows/setup.iss.in @@ -14,7 +14,7 @@ AppVersion={#MyAppVersion} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} -DefaultDirName={code:GetDirName} +DefaultDirName={code:GetDefaultDirectory} DefaultGroupName={#MyAppName} AllowNoIcons=yes ; Uncomment the following line to run in non administrative install mode (install for current user only.) @@ -38,18 +38,18 @@ Source: "@ISS_PLUGIN_FILES_DIR@\*"; DestDir: "{app}"; Flags: ignoreversion recur Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" [Code] -// credit where it's due: -// following function comes from https://github.com/Xaymar/obs-studio_amf-encoder-plugin/blob/master/%23Resources/Installer.in.iss#L45 -function GetDirName(Value: string): string; +function GetDefaultDirectory(Value: String): String; var - InstallPath: string; + sInstallPath: String; begin - // initialize default path, which will be returned when the following registry - // key queries fail due to missing keys or for some different reason - Result := ExpandConstant('{pf}\obs-studio'); - // query the first registry value; if this succeeds, return the obtained value - if RegQueryStringValue(HKLM32, 'SOFTWARE\OBS Studio', '', InstallPath) then - Result := InstallPath + sInstallPath := Value; + if (sInstallPath = '') then + RegQueryStringValue(HKLM64, 'SOFTWARE\OBS Studio', '', sInstallPath); + if (sInstallPath = '') then + RegQueryStringValue(HKCU64, 'SOFTWARE\OBS Studio', '', sInstallPath); + if (sInstallPath = '') then + sInstallPath := ExpandConstant('{commonpf}\obs-studio'); + Result := sInstallPath end; procedure CurStepChanged(CurStep: TSetupStep);