Author: cfinck Date: Sat Jul 21 17:07:54 2007 New Revision: 27766
URL: http://svn.reactos.org/svn/reactos?rev=27766&view=rev Log: Simple change with much effect
By adding one line to the "RosBE.cmd", we can get rid of the global ROSBEBASEDIR environment variable. This also allows us to remove the complete environment variable handling from the Setup Scripts.
Removed: trunk/tools/RosBE-Windows/WriteEnvStr.nsh Modified: trunk/tools/RosBE-Windows/Root/RosBE.cmd trunk/tools/RosBE-Windows/RosBE.nsi
Modified: trunk/tools/RosBE-Windows/Root/RosBE.cmd URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/Root/RosBE.cmd?... ============================================================================== --- trunk/tools/RosBE-Windows/Root/RosBE.cmd (original) +++ trunk/tools/RosBE-Windows/Root/RosBE.cmd Sat Jul 21 17:07:54 2007 @@ -11,6 +11,7 @@ @echo off
set _VER=0.3.7 +set ROSBEBASEDIR=%~dp0
title ReactOS Build Environment %_VER%
Modified: trunk/tools/RosBE-Windows/RosBE.nsi URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/RosBE.nsi?rev=2... ============================================================================== --- trunk/tools/RosBE-Windows/RosBE.nsi (original) +++ trunk/tools/RosBE-Windows/RosBE.nsi Sat Jul 21 17:07:54 2007 @@ -33,7 +33,6 @@
!include "MUI.nsh" !include "RosSourceDir.nsh" -!include "WriteEnvStr.nsh" !include "LogicLib.nsh"
;; MUI begin. @@ -140,12 +139,6 @@ ;; SetOutPath $REACTOS_SOURCE_DIRECTORY CreateShortCut "$QUICKLAUNCH\ReactOS Build Environment.lnk" "$SYSDIR\cmd.exe" '/k "$INSTDIR\RosBE.cmd"' "$INSTDIR\reactos.ico" -SectionEnd - -Section -AddEnvironmentVariable SEC06 - Push "ROSBEBASEDIR" - Push "$INSTDIR" - Call WriteEnvStr SectionEnd
Section -Post SEC07 @@ -206,12 +199,6 @@ Delete /REBOOTOK "$QUICKLAUNCH\ReactOS Build Environment.lnk"
;; - ;; Remove the evironment variable. - ;; - Push "ROSBEBASEDIR" - Call un.DeleteEnvStr - - ;; ;; Clean up the registry. ;; DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
Removed: trunk/tools/RosBE-Windows/WriteEnvStr.nsh URL: http://svn.reactos.org/svn/reactos/trunk/tools/RosBE-Windows/WriteEnvStr.nsh... ============================================================================== --- trunk/tools/RosBE-Windows/WriteEnvStr.nsh (original) +++ trunk/tools/RosBE-Windows/WriteEnvStr.nsh (removed) @@ -1,151 +1,0 @@ -!ifndef _WriteEnvStr_nsh -!define _WriteEnvStr_nsh - -!include "WinMessages.nsh" -!include "LogicLib.nsh" - -!ifndef WriteEnvStr_RegKey - !define WriteEnvStr_RegKey 'HKCU "Environment"' -!endif - -# -# WriteEnvStr - Writes an environment variable -# Note: Win9x systems requires reboot -# -# Example: -# Push "HOMEDIR" # name -# Push "C:\New Home Dir" # value -# Call WriteEnvStr -# -Function WriteEnvStr - Exch $1 ; $1 has environment variable value - Exch - Exch $0 ; $0 has environment variable name - Push $2 - - Call IsNT - Pop $2 - ${if} $2 == "1" - WriteRegExpandStr ${WriteEnvStr_RegKey} $0 $1 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \ - 0 "STR:Environment" /TIMEOUT=5000 - Pop $2 - Pop $0 - Pop $1 - Return - ${endif} - ; Not on NT - StrCpy $2 $WINDIR 2 ; Copy drive of windows (c:) - FileOpen $2 "$2\autoexec.bat" a - FileSeek $2 0 END - FileWrite $2 "$\r$\nSET $0=$1$\r$\n" - FileClose $2 - SetRebootFlag true - Pop $2 - Pop $0 - Pop $1 -FunctionEnd - -# -# un.DeleteEnvStr - Removes an environment variable -# Note: Win9x systems requires reboot -# -# Example: -# Push "HOMEDIR" # name -# Call un.DeleteEnvStr -# -Function un.DeleteEnvStr - Exch $0 ; $0 now has the name of the variable - Push $1 - Push $2 - Push $3 - Push $4 - Push $5 - - Call un.IsNT - Pop $1 - ${if} $1 == "1" - DeleteRegValue ${WriteEnvStr_RegKey} $0 - SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \ - 0 "STR:Environment" /TIMEOUT=5000 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 - Return - ${endif} - ; Not on NT - StrCpy $1 $WINDIR 2 - FileOpen $1 "$1\autoexec.bat" r - GetTempFileName $4 - FileOpen $2 $4 w - StrCpy $0 "SET $0=" - SetRebootFlag true - - DeleteEnvStr_dosLoop: - FileRead $1 $3 - StrLen $5 $0 - StrCpy $5 $3 $5 - ${if} $5 == "$0" - goto DeleteEnvStr_dosLoop - ${endif} - ${if} $5 == "" - goto DeleteEnvStr_dosLoopEnd - ${endif} - FileWrite $2 $3 - Goto DeleteEnvStr_dosLoop - - DeleteEnvStr_dosLoopEnd: - FileClose $2 - FileClose $1 - StrCpy $1 $WINDIR 2 - Delete "$1\autoexec.bat" - CopyFiles /SILENT $4 "$1\autoexec.bat" - Delete $4 - Pop $5 - Pop $4 - Pop $3 - Pop $2 - Pop $1 - Pop $0 -FunctionEnd - -!ifndef IsNT_KiCHiK -!define IsNT_KiCHiK - -# -# [un.]IsNT - Pushes 1 if running on NT, 0 if not -# -# Example: -# Call IsNT -# Pop $0 -# StrCmp $0 1 +3 -# MessageBox MB_OK "Not running on NT!" -# Goto +2 -# MessageBox MB_OK "Running on NT!" -# -!macro IsNT UN -Function ${UN}IsNT - Push $0 - ReadRegStr $0 HKLM \ - "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $0 "" 0 IsNT_yes - ; we are not NT. - Pop $0 - Push 0 - Return - - IsNT_yes: - ; NT!!! - Pop $0 - Push 1 -FunctionEnd -!macroend -!insertmacro IsNT "" -!insertmacro IsNT "un." - -!endif ; IsNT_KiCHiK - -!endif ; _WriteEnvStr_nsh