diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2006-05-10 16:15:00 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2006-05-10 16:15:00 (GMT) |
commit | 5b3a2c84fc26bc74e36ecb187aa4456025fe45ea (patch) | |
tree | a7062f9386cd02f272d6494cdb27280a410aaa8a | |
parent | da8403a163358de3dab57fdd9a0cc3ec8fdf2b60 (diff) | |
download | CMake-5b3a2c84fc26bc74e36ecb187aa4456025fe45ea.zip CMake-5b3a2c84fc26bc74e36ecb187aa4456025fe45ea.tar.gz CMake-5b3a2c84fc26bc74e36ecb187aa4456025fe45ea.tar.bz2 |
ENH: use radio buttons to choose PATH options
-rw-r--r-- | Modules/NSIS.InstallOptions.ini.in | 22 | ||||
-rw-r--r-- | Modules/NSIS.template.in | 27 |
2 files changed, 33 insertions, 16 deletions
diff --git a/Modules/NSIS.InstallOptions.ini.in b/Modules/NSIS.InstallOptions.ini.in index 1472a51..aed2df9 100644 --- a/Modules/NSIS.InstallOptions.ini.in +++ b/Modules/NSIS.InstallOptions.ini.in @@ -1,5 +1,5 @@ [Settings] -NumFields=3 +NumFields=4 [Field 1] Type=label @@ -10,20 +10,28 @@ Top=0 Bottom=20 [Field 2] -Type=checkbox -Text=Check this option to add the path to the system PATH +Type=radiobutton +Text=Do not add @CPACK_PACKAGE_NAME@ to the system PATH Left=0 Right=-1 Top=30 Bottom=40 -State=0 +State=1 [Field 3] -Type=checkbox -Text=If administrator, add to the PATH for all users. +Type=radiobutton +Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for all users Left=0 Right=-1 Top=40 Bottom=50 -State=1 +State=0 +[Field 4] +Type=radiobutton +Text=Add @CPACK_PACKAGE_NAME@ to the system PATH for current user +Left=0 +Right=-1 +Top=50 +Bottom=60 +State=0 diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 0cae5c6..2994c78 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -14,8 +14,9 @@ Var STARTMENU_FOLDER Var SV_ALLUSERS Var START_MENU - Var ADD_TO_PATH + Var DO_NOT_ADD_TO_PATH Var ADD_TO_PATH_ALL_USERS + Var ADD_TO_PATH_CURRENT_USER ;-------------------------------- ;Include Modern UI @@ -66,6 +67,7 @@ Function .onInit StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" + noOptionsPage: FunctionEnd @@ -441,9 +443,10 @@ FunctionEnd Section "Add to path" Push $INSTDIR\bin ;Read a value from an InstallOptions INI file - !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State" !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State" - StrCmp $ADD_TO_PATH "1" 0 doNotAddToPath + !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State" + StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0 Call AddToPath doNotAddToPath: SectionEnd @@ -498,12 +501,15 @@ Section "Installer Section" InstSection Push "StartMenu" Push "$STARTMENU_FOLDER" Call ConditionalAddToRegisty - Push "AddToPath" - Push "$ADD_TO_PATH" + Push "DoNotAddToPath" + Push "$DO_NOT_ADD_TO_PATH" Call ConditionalAddToRegisty Push "AddToPathAllUsers" Push "$ADD_TO_PATH_ALL_USERS" Call ConditionalAddToRegisty + Push "AddToPathCurrentUser" + Push "$ADD_TO_PATH_CURRENT_USER" + Call ConditionalAddToRegisty @CPACK_NSIS_EXTRA_INSTALL_COMMANDS@ @@ -516,6 +522,7 @@ SectionEnd Function InstallOptionsPage !insertmacro MUI_HEADER_TEXT "Install Options" "Chose options for installing @CPACK_PACKAGE_INSTALL_DIRECTORY@" !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini" + FunctionEnd ;-------------------------------- @@ -550,11 +557,13 @@ Section "Uninstall" ReadRegStr $START_MENU SHCTX \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "StartMenu" ;MessageBox MB_OK "Start menu is in: $START_MENU" - ReadRegStr $ADD_TO_PATH SHCTX \ - "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "AddToPath" + ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "DoNotAddToPath" ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "AddToPathAllUsers" - ;MessageBox MB_OK "Add to path: $ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" + ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \ + "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "AddToPathCurrentUser" + ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS" @CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@ @@ -613,7 +622,7 @@ Section "Uninstall" DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" Push $INSTDIR\bin - StrCmp $ADD_TO_PATH "1" 0 doNotRemoveFromPath + StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0 Call un.RemoveFromPath doNotRemoveFromPath: SectionEnd |