Allow for /D to change install directory on the command line.

This commit is contained in:
Bill Hoffman 2009-10-26 17:14:56 -04:00
parent 20fe27cda1
commit 7d9e5b88ff
1 changed files with 16 additions and 4 deletions

View File

@ -18,7 +18,7 @@
Var ADD_TO_PATH_ALL_USERS Var ADD_TO_PATH_ALL_USERS
Var ADD_TO_PATH_CURRENT_USER Var ADD_TO_PATH_CURRENT_USER
Var INSTALL_DESKTOP Var INSTALL_DESKTOP
Var IS_DEFAULT_INSTALLDIR
;-------------------------------- ;--------------------------------
;Include Modern UI ;Include Modern UI
@ -892,7 +892,18 @@ Function .onInit
; Reads components status for registry ; Reads components status for registry
!insertmacro SectionList "InitSection" !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 $SV_ALLUSERS "JustMe"
; 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@" StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
ClearErrors ClearErrors
@ -917,7 +928,8 @@ Function .onInit
;Get installation folder from registry if available ;Get installation folder from registry if available
done: done:
StrCmp $SV_ALLUSERS "AllUsers" 0 +2 StrCmp $SV_ALLUSERS "AllUsers" 0 +3
StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage