From 8ecdc87d0ed33c96caeeeb973702a56a1f8f4c2a Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Wed, 10 May 2023 00:01:33 +0800 Subject: use pushd and popd to tackle venv --- scripts/xrepo.bat | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/xrepo.bat b/scripts/xrepo.bat index 7a5926cdb..5017e3275 100755 --- a/scripts/xrepo.bat +++ b/scripts/xrepo.bat @@ -1,4 +1,5 @@ -@set "XMAKE_EXE=xmake" +@set "XMAKE_ROOTDIR=%~dp0" +@set "XMAKE_EXE=%XMAKE_ROOTDIR%xmake.exe" @if [%1]==[env] ( if [%2]==[quit] ( @@ -88,21 +89,16 @@ echo Please rerun `xrepo env %2 %3 shell` to enter the environment. exit /B 1 ) else ( + pushd %XMAKE_ROOTDIR% setlocal EnableDelayedExpansion - @%XMAKE_EXE% lua --quiet private.xrepo.action.env | findstr . && ( - echo error: corrupt xmake.lua detected in the current directory^^! - exit /B 1 - ) - @%XMAKE_EXE% lua --quiet private.xrepo.action.env - if !errorlevel! neq 0 ( - exit /B !errorlevel! - ) %XMAKE_EXE% lua private.xrepo.action.env.info config %3 if !errorlevel! neq 0 ( + popd exit /B !errorlevel! ) @%XMAKE_EXE% lua --quiet private.xrepo.action.env.info prompt %3 1>nul if !errorlevel! neq 0 ( + popd echo error: environment not found^^! exit /B !errorlevel! ) @@ -120,6 +116,7 @@ @"%XMAKE_EXE%" lua --quiet private.xrepo.action.env.info script.cmd %3 1>"%%i.bat" call "%%i.bat" ) + popd goto :ENDXREPO ) ) -- cgit v1.3.1