From e3936dad9bb0a632365c60c254e9a31e4b7c1e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lepin?= Date: Sun, 4 Dec 2016 20:23:59 +0100 Subject: [PATCH] Updated installer --- installer/installer.iss | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/installer/installer.iss b/installer/installer.iss index 7e9fb5ea..c2ff933d 100644 --- a/installer/installer.iss +++ b/installer/installer.iss @@ -18,7 +18,7 @@ AppPublisher={#MyAppPublisher} AppPublisherURL={#MyAppURL} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} -DefaultDirName={pf}\obs-studio +DefaultDirName={code:GetDirName} DefaultGroupName={#MyAppName} OutputBaseFilename=obs-websocket-{#MyAppVersion}-Windows-Installer Compression=lzma @@ -37,3 +37,18 @@ Source: "..\release\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs cr Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}" Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}" +[Code] +// 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; +var + InstallPath: 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 := '{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 +end; +