add setlocal

This commit is contained in:
Dax T. Games 2020-08-23 08:42:58 -04:00
parent 2cd7632720
commit b1ef763922
2 changed files with 17 additions and 14 deletions

View File

@ -232,30 +232,33 @@ exit /b
:compare_git_versions :compare_git_versions
if ERRORLEVEL 0 ( if ERRORLEVEL 0 (
setlocal enabledelayedexpansion
:: compare the user git version against the vendored version :: compare the user git version against the vendored version
%lib_git% compare_versions USER VENDORED !lib_git! compare_versions USER VENDORED
:: use the user provided git if its version is greater than, or equal to the vendored git :: use the user provided git if its version is greater than, or equal to the vendored git
if ERRORLEVEL 0 ( if ERRORLEVEL 0 (
if exist "%test_dir:~0,-4%\cmd\git.exe" ( if exist "!test_dir:~0,-4!\cmd\git.exe" (
set "GIT_INSTALL_ROOT=%test_dir:~0,-4%" set "GIT_INSTALL_ROOT=!test_dir:~0,-4!"
set test_dir= set test_dir=
) else ( ) else (
set "GIT_INSTALL_ROOT=%test_dir%" set "GIT_INSTALL_ROOT=!test_dir!"
set test_dir= set test_dir=
) )
) else ( ) else (
%lib_console% verbose_output "Found old %GIT_VERSION_USER% in %test_dir%, but not using..." !lib_console! verbose_output "Found old !GIT_VERSION_USER! in !test_dir!, but not using..."
set test_dir= set test_dir=
) )
endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%
) else ( ) else (
:: compare the user git version against the vendored version :: compare the user git version against the vendored version
:: if the user provided git executable is not found :: if the user provided git executable is not found
IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 ( IF ERRORLEVEL -255 IF NOT ERRORLEVEL -254 (
%lib_console% verbose_output "No git at "%git_executable%" found." !lib_console! verbose_output "No git at "!git_executable!" found."
set test_dir= set test_dir=
) )
) )
exit /b exit /b
:::=============================================================================== :::===============================================================================

View File

@ -77,24 +77,24 @@ exit /b
set OLD_PATH=%PATH% set OLD_PATH=%PATH%
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
if "%found%" == "0" (
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%;"
call :set_found
)
%lib_console% debug_output :enhance_path "Env Var INSIDE PATH %find_query% - found=%found%"
if /i "%position%" == "append" (
if "!found!" == "0" ( if "!found!" == "0" (
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%\"$" echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!;"
call :set_found call :set_found
) )
%lib_console% debug_output :enhance_path "Env Var END PATH %find_query% - found=!found!" !lib_console! debug_output :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!"
if /i "!position!" == "append" (
if "!found!" == "0" (
echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:";!find_query!\"$"
call :set_found
)
!lib_console! debug_output :enhance_path "Env Var END PATH !find_query! - found=!found!"
) else ( ) else (
if "!found!" == "0" ( if "!found!" == "0" (
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:"^\"%find_query%;" echo "!path!"|!WINDIR!\System32\findstr >nul /I /R /C:"^\"!find_query!;"
call :set_found call :set_found
) )
%lib_console% debug_output :enhance_path "Env Var BEGIN PATH %find_query% - found=!found!" !lib_console! debug_output :enhance_path "Env Var BEGIN PATH !find_query! - found=!found!"
) )
endlocal & set found=%found% endlocal & set found=%found%