- IfFileExists $0 "" AddToPath_done
-
- Call SDCC.IsNT
- Pop $4
- StrCmp $4 1 +3
- ; Not on NT: read PATH from environment variable
- ReadEnvStr $1 PATH
- Goto +2
- ; On NT: read PATH from registry
- ReadRegStr $1 HKCU "Environment" "PATH"
- ${StrStr} $2 "$1;" "$0;"
- StrCmp $2 "" "" AddToPath_done
-
- ${StrStr} $2 "$1;" "$0\;"
- StrCmp $2 "" "" AddToPath_done
-
- GetFullPathName /SHORT $3 $0
- ${StrStr} $2 "$1;" "$3;"
- StrCmp $2 "" "" AddToPath_done
-
- ${StrStr} $2 "$1;" "$03\;"
- StrCmp $2 "" "" AddToPath_done
-
- StrCmp $4 1 AddToPath_NT
- ; Not on NT
- StrCpy $1 $WINDIR 2
- FileOpen $1 "$1\autoexec.bat" a
- FileSeek $1 -1 END
- FileReadByte $1 $2
- IntCmp $2 26 0 +2 +2 ; DOS EOF
- FileSeek $1 -1 END ; write over EOF
- FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
- FileClose $1
- SetRebootFlag true
- Goto AddToPath_done
+ ${If} ${FileExists} $0
+ Call SDCC.IsNT
+ Pop $4
+ ${If} $4 != 1
+ ; Not on NT: read PATH from environment variable
+ ReadEnvStr $1 PATH
+ ${Else}
+ ; On NT: read PATH from registry
+ ReadRegStr $1 HKCU "Environment" "PATH"
+ ${EndIf}