From e0154c2c7bcc684beede0ba8f65f05b1300da7af Mon Sep 17 00:00:00 2001 From: Whindmar Saksit Date: Fri, 25 Aug 2023 01:19:20 +0200 Subject: [PATCH 1/2] Installer should not hardcode the installdir path This changes $INSTDIR to respect InstallDirRegKey. If not present, the default is the drive of %ProgramFiles% instead of forcing c:\. --- RosBE-Windows/RosBE.nsi | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/RosBE-Windows/RosBE.nsi b/RosBE-Windows/RosBE.nsi index 33fb63b6..6321f932 100644 --- a/RosBE-Windows/RosBE.nsi +++ b/RosBE-Windows/RosBE.nsi @@ -52,7 +52,12 @@ Function .onInit StrCmp $R0 0 +3 MessageBox MB_OK|MB_ICONEXCLAMATION "The ${PRODUCT_NAME} v${PRODUCT_VERSION} installer is already running." Abort - StrCpy $INSTDIR "C:\RosBE" + + ${If} $INSTDIR == "" ; InstallDirRegKey not valid? + StrCpy $0 $ProgramFiles 1 + StrCpy $INSTDIR "$0:\RosBE" + ${EndIf} + Call UninstallPrevious !insertmacro INSTALLOPTIONS_EXTRACT "RosSourceDir.ini" FunctionEnd From f08cb4321e427b382d9d443226b3e0b7f66e0b13 Mon Sep 17 00:00:00 2001 From: Whindmar Saksit Date: Thu, 26 Dec 2024 17:08:48 +0100 Subject: [PATCH 2/2] Use SysDir with C as fallback --- RosBE-Windows/RosBE.nsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RosBE-Windows/RosBE.nsi b/RosBE-Windows/RosBE.nsi index 6321f932..603b39b0 100644 --- a/RosBE-Windows/RosBE.nsi +++ b/RosBE-Windows/RosBE.nsi @@ -54,7 +54,10 @@ Function .onInit Abort ${If} $INSTDIR == "" ; InstallDirRegKey not valid? - StrCpy $0 $ProgramFiles 1 + StrCpy $0 $SysDir 1 + ${If} $0 == "\" + StrCpy $0 'C' + ${EndIf} StrCpy $INSTDIR "$0:\RosBE" ${EndIf}