Skip to content

Commit

Permalink
add setlocal
Browse files Browse the repository at this point in the history
  • Loading branch information
Dax T. Games committed Aug 23, 2020
1 parent 2cd7632 commit b1ef763
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
15 changes: 9 additions & 6 deletions vendor/lib/lib_git.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -232,30 +232,33 @@ exit /b

:compare_git_versions
if ERRORLEVEL 0 (
setlocal enabledelayedexpansion
:: 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
if ERRORLEVEL 0 (
if exist "%test_dir:~0,-4%\cmd\git.exe" (
set "GIT_INSTALL_ROOT=%test_dir:~0,-4%"
if exist "!test_dir:~0,-4!\cmd\git.exe" (
set "GIT_INSTALL_ROOT=!test_dir:~0,-4!"
set test_dir=
) else (
set "GIT_INSTALL_ROOT=%test_dir%"
set "GIT_INSTALL_ROOT=!test_dir!"
set test_dir=
)
) 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=
)
endlocal && set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%
) else (
:: compare the user git version against the vendored version
:: if the user provided git executable is not found
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=
)
)

exit /b

:::===============================================================================
Expand Down
16 changes: 8 additions & 8 deletions vendor/lib/lib_path.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,24 @@ exit /b
set OLD_PATH=%PATH%

setlocal enabledelayedexpansion
if "%found%" == "0" (
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%;"
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%"
!lib_console! debug_output :enhance_path "Env Var INSIDE PATH !find_query! - found=!found!"

if /i "%position%" == "append" (
if /i "!position!" == "append" (
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
)
%lib_console% debug_output :enhance_path "Env Var END PATH %find_query% - found=!found!"
!lib_console! debug_output :enhance_path "Env Var END PATH !find_query! - found=!found!"
) else (
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
)
%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%

Expand Down

0 comments on commit b1ef763

Please sign in to comment.