Rev 241 | Go to most recent revision | Blame | Last modification | View Log | RSS feed
!include "LogicLib.nsh"
!include "WinMessages.NSH"
; The name of the installer
Name "GEL Externals"
; The file to write
OutFile "GELexternals.exe"
; The default installation directory
InstallDir $DESKTOP\test
;--------------------------------
; Pages
Page directory
Page components
InstType "Externals only"
InstType "Full"
Section "Externals" Externals
SectionIn 1 2
SectionEnd
Section "GEL binary (ver. 0.1)" GEL
SectionIn 2
SectionEnd
Page instfiles
;--------------------------------
Section ""
# Get flags of first section (which is index #0) into register $0
SectionGetFlags ${Externals} $0
# Get flags of second section (which is index #1) into register $1
SectionGetFlags ${GEL} $1
;MessageBox MB_OK "Externals: $0 $\r$\n GEL: $1 $\r$\n "
${If} $0 = 1
SetOutPath $INSTDIR\bin
File externals\bin\*.dll
SetOutPath $INSTDIR\lib
File externals\lib\*.lib
SetOutPath $INSTDIR
File /r externals\include
${EndIf}
${If} $1 = 1
SetOutPath $INSTDIR\lib
File current\lib\*.lib
SetOutPath $INSTDIR
File /r current\include
${EndIf}
# Create Environment variables
WriteRegExpandStr HKCU "Environment" "GEL_INCLUDE" "$INSTDIR\include"
WriteRegExpandStr HKCU "Environment" "GEL_LIB" "$INSTDIR\lib"
WriteRegExpandStr HKCU "Environment" "GEL_BIN" "$INSTDIR\bin"
# Add %GEL_BIN% to path
ReadRegStr $1 HKCU "Environment" "PATH"
StrCpy $2 $1 1 -1 # copy last char
StrCmp $2 ";" 0 +2 # if last char == ;
StrCpy $1 $1 -1 # remove last char
StrCmp $1 "" AddToPath_NTdoIt
StrCpy $0 "$1;%GEL_BIN%"
AddToPath_NTdoIt:
WriteRegExpandStr HKCU "Environment" "PATH" $0
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
SectionEnd ; end the section