ENH: allow for desktop link to be created and fix chop of last char in PATH on uninstall
This commit is contained in:
parent
ec207513e4
commit
0eba9b638f
|
@ -42,6 +42,7 @@ IF(EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake")
|
||||||
# sure there is at least one set of four (4) backlasshes.
|
# sure there is at least one set of four (4) backlasshes.
|
||||||
SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp")
|
SET(CPACK_PACKAGE_ICON "${CMake_SOURCE_DIR}/Utilities/Release\\\\CMakeInstall.bmp")
|
||||||
SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake")
|
SET(CPACK_PACKAGE_EXECUTABLES "CMakeSetup" "CMake")
|
||||||
|
SET(CPACK_CREATE_DESKTOP_LINK_CMakeSetup 1)
|
||||||
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\CMakeSetup.exe")
|
SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\CMakeSetup.exe")
|
||||||
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} a cross-platform, open-source build system")
|
SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} a cross-platform, open-source build system")
|
||||||
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.cmake.org")
|
SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\www.cmake.org")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[Settings]
|
[Settings]
|
||||||
NumFields=4
|
NumFields=5
|
||||||
|
|
||||||
[Field 1]
|
[Field 1]
|
||||||
Type=label
|
Type=label
|
||||||
|
@ -35,3 +35,12 @@ Right=-1
|
||||||
Top=50
|
Top=50
|
||||||
Bottom=60
|
Bottom=60
|
||||||
State=0
|
State=0
|
||||||
|
|
||||||
|
[Field 5]
|
||||||
|
Type=CheckBox
|
||||||
|
Text=Create @CPACK_PACKAGE_NAME@ Desktop Icon
|
||||||
|
Left=0
|
||||||
|
Right=-1
|
||||||
|
Top=80
|
||||||
|
Bottom=90
|
||||||
|
State=0
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
Var DO_NOT_ADD_TO_PATH
|
Var DO_NOT_ADD_TO_PATH
|
||||||
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
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Include Modern UI
|
;Include Modern UI
|
||||||
|
@ -122,182 +123,173 @@ FunctionEnd
|
||||||
;----------------------------------------------------
|
;----------------------------------------------------
|
||||||
!define NT_current_env 'HKCU "Environment"'
|
!define NT_current_env 'HKCU "Environment"'
|
||||||
!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||||
;====================================================
|
|
||||||
|
!ifndef WriteEnvStr_RegKey
|
||||||
|
!ifdef ALL_USERS
|
||||||
|
!define WriteEnvStr_RegKey \
|
||||||
|
'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||||
|
!else
|
||||||
|
!define WriteEnvStr_RegKey 'HKCU "Environment"'
|
||||||
|
!endif
|
||||||
|
!endif
|
||||||
|
|
||||||
; AddToPath - Adds the given dir to the search path.
|
; AddToPath - Adds the given dir to the search path.
|
||||||
; Input - head of the stack
|
; Input - head of the stack
|
||||||
; Note - Win9x systems requires reboot
|
; Note - Win9x systems requires reboot
|
||||||
;====================================================
|
|
||||||
Function AddToPath
|
Function AddToPath
|
||||||
Exch $0
|
Exch $0
|
||||||
Push $1
|
Push $1
|
||||||
Push $2
|
Push $2
|
||||||
|
Push $3
|
||||||
|
|
||||||
Call IsNT
|
# don't add if the path doesn't exist
|
||||||
Pop $1
|
IfFileExists "$0\*.*" "" AddToPath_done
|
||||||
StrCmp $1 1 AddToPath_NT
|
|
||||||
; Not on NT
|
|
||||||
StrCpy $1 $WINDIR 2
|
|
||||||
FileOpen $1 "$1\autoexec.bat" a
|
|
||||||
FileSeek $1 0 END
|
|
||||||
GetFullPathName /SHORT $0 $0
|
|
||||||
FileWrite $1 "$\r$\n\
|
|
||||||
$\r$\n\
|
|
||||||
SET PATH=%PATH%;$0$\r$\n\
|
|
||||||
$\r$\n\
|
|
||||||
"
|
|
||||||
FileClose $1
|
|
||||||
Goto AddToPath_done
|
|
||||||
|
|
||||||
AddToPath_NT:
|
ReadEnvStr $1 PATH
|
||||||
Push $4
|
Push "$1;"
|
||||||
Call select_NT_profile
|
Push "$0;"
|
||||||
Pop $4
|
Call StrStr
|
||||||
|
Pop $2
|
||||||
|
StrCmp $2 "" "" AddToPath_done
|
||||||
|
Push "$1;"
|
||||||
|
Push "$0\;"
|
||||||
|
Call StrStr
|
||||||
|
Pop $2
|
||||||
|
StrCmp $2 "" "" AddToPath_done
|
||||||
|
GetFullPathName /SHORT $3 $0
|
||||||
|
Push "$1;"
|
||||||
|
Push "$3;"
|
||||||
|
Call StrStr
|
||||||
|
Pop $2
|
||||||
|
StrCmp $2 "" "" AddToPath_done
|
||||||
|
Push "$1;"
|
||||||
|
Push "$3\;"
|
||||||
|
Call StrStr
|
||||||
|
Pop $2
|
||||||
|
StrCmp $2 "" "" AddToPath_done
|
||||||
|
|
||||||
AddToPath_NT_selection_done:
|
Call IsNT
|
||||||
StrCmp $4 "current" read_path_NT_current
|
Pop $1
|
||||||
ReadRegStr $1 ${NT_all_env} "PATH"
|
StrCmp $1 1 AddToPath_NT
|
||||||
Goto read_path_NT_resume
|
; Not on NT
|
||||||
read_path_NT_current:
|
StrCpy $1 $WINDIR 2
|
||||||
ReadRegStr $1 ${NT_current_env} "PATH"
|
FileOpen $1 "$1\autoexec.bat" a
|
||||||
read_path_NT_resume:
|
FileSeek $1 -1 END
|
||||||
StrCmp $1 "" AddToPath_NoCurrentPath
|
FileReadByte $1 $2
|
||||||
StrCpy $2 "$0;$1"
|
IntCmp $2 26 0 +2 +2 # DOS EOF
|
||||||
Goto AddToPath_NTdoIt
|
FileSeek $1 -1 END # write over EOF
|
||||||
AddToPath_NoCurrentPath:
|
FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
|
||||||
DetailPrint "No current path, so just use $0"
|
FileClose $1
|
||||||
StrCpy $2 $0
|
SetRebootFlag true
|
||||||
Goto AddToPath_NTdoIt
|
Goto AddToPath_done
|
||||||
AddToPath_NTdoIt:
|
|
||||||
StrCmp $4 "current" write_path_NT_current
|
|
||||||
ClearErrors
|
|
||||||
WriteRegExpandStr ${NT_all_env} "PATH" $2
|
|
||||||
IfErrors 0 write_path_NT_resume
|
|
||||||
MessageBox MB_YESNO|MB_ICONQUESTION "The path could not be set for all users$\n\
|
|
||||||
$\n\
|
|
||||||
Should I try for the current user?" \
|
|
||||||
IDNO write_path_NT_failed
|
|
||||||
; change selection
|
|
||||||
StrCpy $4 "current"
|
|
||||||
Goto AddToPath_NT_selection_done
|
|
||||||
write_path_NT_current:
|
|
||||||
ClearErrors
|
|
||||||
WriteRegExpandStr ${NT_current_env} "PATH" $2
|
|
||||||
IfErrors 0 write_path_NT_resume
|
|
||||||
MessageBox MB_OK|MB_ICONINFORMATION "The path could not be set for the current user."
|
|
||||||
Goto write_path_NT_failed
|
|
||||||
write_path_NT_resume:
|
|
||||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
|
||||||
DetailPrint "Added path for user ($4), $0"
|
|
||||||
DetailPrint "New path is: $2"
|
|
||||||
write_path_NT_failed:
|
|
||||||
|
|
||||||
Pop $4
|
AddToPath_NT:
|
||||||
AddToPath_done:
|
ReadRegStr $1 ${WriteEnvStr_RegKey} "PATH"
|
||||||
Pop $2
|
StrCmp $1 "" AddToPath_NTdoIt
|
||||||
Pop $1
|
Push $1
|
||||||
Pop $0
|
Call Trim
|
||||||
|
Pop $1
|
||||||
|
StrCpy $0 "$1;$0"
|
||||||
|
AddToPath_NTdoIt:
|
||||||
|
WriteRegExpandStr ${WriteEnvStr_RegKey} "PATH" $0
|
||||||
|
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||||
|
|
||||||
|
AddToPath_done:
|
||||||
|
Pop $3
|
||||||
|
Pop $2
|
||||||
|
Pop $1
|
||||||
|
Pop $0
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
;====================================================
|
|
||||||
; RemoveFromPath - Remove a given dir from the path
|
; RemoveFromPath - Remove a given dir from the path
|
||||||
; Input: head of the stack
|
; Input: head of the stack
|
||||||
;====================================================
|
|
||||||
Function un.RemoveFromPath
|
Function un.RemoveFromPath
|
||||||
Exch $0
|
Exch $0
|
||||||
Push $1
|
Push $1
|
||||||
Push $2
|
Push $2
|
||||||
Push $3
|
Push $3
|
||||||
Push $4
|
Push $4
|
||||||
|
Push $5
|
||||||
|
Push $6
|
||||||
|
|
||||||
Call un.IsNT
|
IntFmt $6 "%c" 26 # DOS EOF
|
||||||
Pop $1
|
|
||||||
StrCmp $1 1 unRemoveFromPath_NT
|
Call un.IsNT
|
||||||
; Not on NT
|
Pop $1
|
||||||
StrCpy $1 $WINDIR 2
|
StrCmp $1 1 unRemoveFromPath_NT
|
||||||
FileOpen $1 "$1\autoexec.bat" r
|
; Not on NT
|
||||||
GetTempFileName $4
|
StrCpy $1 $WINDIR 2
|
||||||
FileOpen $2 $4 w
|
FileOpen $1 "$1\autoexec.bat" r
|
||||||
GetFullPathName /SHORT $0 $0
|
GetTempFileName $4
|
||||||
StrCpy $0 "SET PATH=%PATH%;$0"
|
FileOpen $2 $4 w
|
||||||
SetRebootFlag true
|
GetFullPathName /SHORT $0 $0
|
||||||
|
StrCpy $0 "SET PATH=%PATH%;$0"
|
||||||
|
Goto unRemoveFromPath_dosLoop
|
||||||
|
|
||||||
|
unRemoveFromPath_dosLoop:
|
||||||
|
FileRead $1 $3
|
||||||
|
StrCpy $5 $3 1 -1 # read last char
|
||||||
|
StrCmp $5 $6 0 +2 # if DOS EOF
|
||||||
|
StrCpy $3 $3 -1 # remove DOS EOF so we can compare
|
||||||
|
StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
|
||||||
|
StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
|
||||||
|
StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
|
||||||
|
StrCmp $3 "" unRemoveFromPath_dosLoopEnd
|
||||||
|
FileWrite $2 $3
|
||||||
Goto unRemoveFromPath_dosLoop
|
Goto unRemoveFromPath_dosLoop
|
||||||
|
unRemoveFromPath_dosLoopRemoveLine:
|
||||||
|
SetRebootFlag true
|
||||||
|
Goto unRemoveFromPath_dosLoop
|
||||||
|
|
||||||
unRemoveFromPath_dosLoop:
|
unRemoveFromPath_dosLoopEnd:
|
||||||
FileRead $1 $3
|
FileClose $2
|
||||||
StrCmp $3 "$0$$\r$\n\
|
FileClose $1
|
||||||
$\r$\n\
|
StrCpy $1 $WINDIR 2
|
||||||
" unRemoveFromPath_dosLoop
|
Delete "$1\autoexec.bat"
|
||||||
StrCmp $3 "$0$\r$\n\
|
CopyFiles /SILENT $4 "$1\autoexec.bat"
|
||||||
" unRemoveFromPath_dosLoop
|
Delete $4
|
||||||
StrCmp $3 "$0" unRemoveFromPath_dosLoop
|
Goto unRemoveFromPath_done
|
||||||
StrCmp $3 "" unRemoveFromPath_dosLoopEnd
|
|
||||||
FileWrite $2 $3
|
|
||||||
Goto unRemoveFromPath_dosLoop
|
|
||||||
|
|
||||||
unRemoveFromPath_dosLoopEnd:
|
unRemoveFromPath_NT:
|
||||||
FileClose $2
|
ReadRegStr $1 ${WriteEnvStr_RegKey} "PATH"
|
||||||
FileClose $1
|
StrCpy $5 $1 1 -1 # copy last char
|
||||||
StrCpy $1 $WINDIR 2
|
StrCmp $5 ";" +2 # if last char != ;
|
||||||
Delete "$1\autoexec.bat"
|
StrCpy $1 "$1;" # append ;
|
||||||
CopyFiles /SILENT $4 "$1\autoexec.bat"
|
Push $1
|
||||||
Delete $4
|
Push "$0;"
|
||||||
Goto unRemoveFromPath_done
|
Call un.StrStr ; Find `$0;` in $1
|
||||||
|
Pop $2 ; pos of our dir
|
||||||
|
StrCmp $2 "" unRemoveFromPath_done
|
||||||
|
; else, it is in path
|
||||||
|
# $0 - path to add
|
||||||
|
# $1 - path var
|
||||||
|
StrLen $3 "$0;"
|
||||||
|
StrLen $4 $2
|
||||||
|
StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
|
||||||
|
StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
|
||||||
|
StrCpy $3 $5$6
|
||||||
|
|
||||||
unRemoveFromPath_NT:
|
StrCpy $5 $3 1 -1 # copy last char
|
||||||
StrLen $2 $0
|
StrCmp $5 ";" 0 +2 # if last char == ;
|
||||||
Call un.select_NT_profile
|
StrCpy $3 $3 -1 # remove last char
|
||||||
Pop $4
|
|
||||||
|
|
||||||
StrCmp $4 "current" un_read_path_NT_current
|
WriteRegExpandStr ${WriteEnvStr_RegKey} "PATH" $3
|
||||||
ReadRegStr $1 ${NT_all_env} "PATH"
|
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||||
Goto un_read_path_NT_resume
|
|
||||||
un_read_path_NT_current:
|
|
||||||
ReadRegStr $1 ${NT_current_env} "PATH"
|
|
||||||
un_read_path_NT_resume:
|
|
||||||
|
|
||||||
StrCpy $8 $0
|
unRemoveFromPath_done:
|
||||||
Push $1
|
Pop $6
|
||||||
Push $0
|
Pop $5
|
||||||
Call un.StrStr ; Find $0 in $1
|
Pop $4
|
||||||
Pop $0 ; pos of our dir
|
Pop $3
|
||||||
IntCmp $0 -1 unRemoveFromPath_done
|
Pop $2
|
||||||
; else, it is in path
|
Pop $1
|
||||||
StrLen $5 $1 ; Get the length of the original path
|
Pop $0
|
||||||
StrLen $6 $0 ; get the length of path without the first path
|
|
||||||
IntOp $5 $5 - $6
|
|
||||||
IntOp $5 $5 - 1
|
|
||||||
IntCmp $5 -1 unRemoveFromPath_nothingBefore
|
|
||||||
StrCpy $3 $1 $5 ; $3 now has the part of the path before our dir
|
|
||||||
Goto unRemoveFromPath_AfterBefore
|
|
||||||
unRemoveFromPath_nothingBefore:
|
|
||||||
StrCpy $3 ""
|
|
||||||
unRemoveFromPath_AfterBefore:
|
|
||||||
StrCpy $7 $0 "" $2 ; $3 now has the part of the path after our dir
|
|
||||||
StrCpy $3 "$3$7"
|
|
||||||
|
|
||||||
; $3 now holds path, but there may be some stray semicolon at
|
|
||||||
; beginning. Let's remove it
|
|
||||||
StrCpy $7 $3 1
|
|
||||||
StrCmp $7 ";" 0 unRemoveFromPath_NoTrailingSemiColon
|
|
||||||
StrCpy $3 $3 "" 1
|
|
||||||
unRemoveFromPath_NoTrailingSemiColon:
|
|
||||||
|
|
||||||
StrCmp $4 "current" un_write_path_NT_current
|
|
||||||
WriteRegExpandStr ${NT_all_env} "PATH" $3
|
|
||||||
Goto un_write_path_NT_resume
|
|
||||||
un_write_path_NT_current:
|
|
||||||
WriteRegExpandStr ${NT_current_env} "PATH" $3
|
|
||||||
un_write_path_NT_resume:
|
|
||||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
|
||||||
DetailPrint "Removed $8 from the path"
|
|
||||||
DetailPrint "New path is: $3"
|
|
||||||
unRemoveFromPath_done:
|
|
||||||
Pop $4
|
|
||||||
Pop $3
|
|
||||||
Pop $2
|
|
||||||
Pop $1
|
|
||||||
Pop $0
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; Uninstall sutff
|
; Uninstall sutff
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -385,6 +377,24 @@ FunctionEnd
|
||||||
!insertmacro StrStr ""
|
!insertmacro StrStr ""
|
||||||
!insertmacro StrStr "un."
|
!insertmacro StrStr "un."
|
||||||
|
|
||||||
|
Function Trim ; Added by Pelaca
|
||||||
|
Exch $R1
|
||||||
|
Push $R2
|
||||||
|
Loop:
|
||||||
|
StrCpy $R2 "$R1" 1 -1
|
||||||
|
StrCmp "$R2" " " RTrim
|
||||||
|
StrCmp "$R2" "$\n" RTrim
|
||||||
|
StrCmp "$R2" "$\r" RTrim
|
||||||
|
StrCmp "$R2" ";" RTrim
|
||||||
|
GoTo Done
|
||||||
|
RTrim:
|
||||||
|
StrCpy $R1 "$R1" -1
|
||||||
|
Goto Loop
|
||||||
|
Done:
|
||||||
|
Pop $R2
|
||||||
|
Exch $R1
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Function ConditionalAddToRegisty
|
Function ConditionalAddToRegisty
|
||||||
Pop $0
|
Pop $0
|
||||||
Pop $1
|
Pop $1
|
||||||
|
@ -443,17 +453,6 @@ FunctionEnd
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Installer Sections
|
;Installer Sections
|
||||||
|
|
||||||
Section "Add to path"
|
|
||||||
Push $INSTDIR\bin
|
|
||||||
;Read a value from an InstallOptions INI file
|
|
||||||
!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"
|
|
||||||
!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
|
|
||||||
|
|
||||||
Section "Installer Section" InstSection
|
Section "Installer Section" InstSection
|
||||||
|
|
||||||
;Use the entire tree produced by the INSTALL target. Keep the
|
;Use the entire tree produced by the INSTALL target. Keep the
|
||||||
|
@ -492,7 +491,7 @@ Section "Installer Section" InstSection
|
||||||
Push "Contact"
|
Push "Contact"
|
||||||
Push "@CPACK_NSIS_CONTACT@"
|
Push "@CPACK_NSIS_CONTACT@"
|
||||||
Call ConditionalAddToRegisty
|
Call ConditionalAddToRegisty
|
||||||
|
!insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
|
||||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
||||||
|
|
||||||
;Create shortcuts
|
;Create shortcuts
|
||||||
|
@ -513,6 +512,9 @@ Section "Installer Section" InstSection
|
||||||
Push "AddToPathCurrentUser"
|
Push "AddToPathCurrentUser"
|
||||||
Push "$ADD_TO_PATH_CURRENT_USER"
|
Push "$ADD_TO_PATH_CURRENT_USER"
|
||||||
Call ConditionalAddToRegisty
|
Call ConditionalAddToRegisty
|
||||||
|
Push "InstallToDesktop"
|
||||||
|
Push "$INSTALL_DESKTOP"
|
||||||
|
Call ConditionalAddToRegisty
|
||||||
|
|
||||||
@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
|
@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
|
||||||
|
|
||||||
|
@ -520,6 +522,18 @@ Section "Installer Section" InstSection
|
||||||
|
|
||||||
SectionEnd
|
SectionEnd
|
||||||
|
|
||||||
|
Section "Add to path"
|
||||||
|
Push $INSTDIR\bin
|
||||||
|
;Read a value from an InstallOptions INI file
|
||||||
|
!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"
|
||||||
|
!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
|
||||||
|
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
; Create custom pages
|
; Create custom pages
|
||||||
Function InstallOptionsPage
|
Function InstallOptionsPage
|
||||||
|
@ -567,6 +581,9 @@ Section "Uninstall"
|
||||||
ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
|
ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
|
||||||
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "AddToPathCurrentUser"
|
"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"
|
;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
|
||||||
|
ReadRegStr $INSTALL_DESKTOP SHCTX \
|
||||||
|
"Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_DIRECTORY@" "InstallToDesktop"
|
||||||
|
;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
|
||||||
|
|
||||||
@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
|
@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
|
||||||
|
|
||||||
|
|
|
@ -241,6 +241,20 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName
|
deleteStr << " Delete \"$SMPROGRAMS\\$MUI_TEMP\\" << linkName
|
||||||
<< ".lnk\"" << std::endl;
|
<< ".lnk\"" << std::endl;
|
||||||
|
// see if CPACK_CREATE_DESKTOP_LINK_ExeName is on
|
||||||
|
// if so add a desktop link
|
||||||
|
std::string desktop = "CPACK_CREATE_DESKTOP_LINK_";
|
||||||
|
desktop += execName;
|
||||||
|
if(this->IsSet(desktop.c_str()))
|
||||||
|
{
|
||||||
|
str << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
|
||||||
|
str << " CreateShortCut \"$DESKTOP\\"
|
||||||
|
<< linkName << ".lnk\" \"$INSTDIR\\bin\\" << execName << ".exe\""
|
||||||
|
<< std::endl;
|
||||||
|
deleteStr << " StrCmp \"$INSTALL_DESKTOP\" \"1\" 0 +2\n";
|
||||||
|
deleteStr << " Delete \"$DESKTOP\\" << linkName
|
||||||
|
<< ".lnk\"" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this->SetOptionIfNotSet("CPACK_NSIS_CREATE_ICONS", str.str().c_str());
|
this->SetOptionIfNotSet("CPACK_NSIS_CREATE_ICONS", str.str().c_str());
|
||||||
this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS",
|
this->SetOptionIfNotSet("CPACK_NSIS_DELETE_ICONS",
|
||||||
|
|
Loading…
Reference in New Issue