From 7d9e5b88ffaa0e511b0f1282dee2ed262142d269 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 26 Oct 2009 17:14:56 -0400 Subject: Allow for /D to change install directory on the command line. --- Modules/NSIS.template.in | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index c18104d..d90967d 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -18,7 +18,7 @@ Var ADD_TO_PATH_ALL_USERS Var ADD_TO_PATH_CURRENT_USER Var INSTALL_DESKTOP - + Var IS_DEFAULT_INSTALLDIR ;-------------------------------- ;Include Modern UI @@ -892,8 +892,19 @@ Function .onInit ; Reads components status for registry !insertmacro SectionList "InitSection" + ; check to see if /D has been used to change + ; the install directory by comparing it to the + ; install directory that is expected to be the + ; default + StrCpy $IS_DEFAULT_INSTALLDIR 0 + StrCmp "$INSTDIR" "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2 + StrCpy $IS_DEFAULT_INSTALLDIR 1 + StrCpy $SV_ALLUSERS "JustMe" - StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + ; if default install dir then change the default + ; if it is installed for JustMe + StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 + StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@" ClearErrors UserInfo::GetName @@ -917,8 +928,9 @@ Function .onInit ;Get installation folder from registry if available done: - StrCmp $SV_ALLUSERS "AllUsers" 0 +2 - StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" + StrCmp $SV_ALLUSERS "AllUsers" 0 +3 + StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2 + StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" -- cgit v0.12