BaseTools: Fix incorrect %EDK_TOOLS_PATH%

For non-root folder, such as "X:\test", the EDK_TOOLS_PATH will
resolve to "X:\test\edk2\BaseTools". This is OK.

But if WORKSPACE is at a root folder, such as "X:\", the EDK_TOOLS_PATH
will look like "X:\\BaseTools". The *double backslash* can fail the command
like "del" and thus affect the %ERRORLEVEL% variable, which may break
subsequent build processing.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yunhua Feng 2018-08-07 09:35:33 +08:00 committed by Yonghong Zhu
parent b6e48ec641
commit 40d1adb3eb
1 changed files with 25 additions and 14 deletions

View File

@ -59,22 +59,33 @@ if /I "%1"=="/help" goto Usage
if /I "%1"=="NewBuild" shift if /I "%1"=="NewBuild" shift
if not defined EDK_TOOLS_PATH ( if not defined EDK_TOOLS_PATH (
if exist %WORKSPACE%\BaseTools ( goto SetEdkToolsPath
set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools ) else (
) else ( goto checkNt32Flag
if defined PACKAGES_PATH ( )
for %%i IN (%PACKAGES_PATH%) DO (
if exist %%~fi\BaseTools ( :SetEdkToolsPath
set EDK_TOOLS_PATH=%%~fi\BaseTools if %WORKSPACE:~-1% EQU \ (
goto checkNt32Flag @set EDK_BASETOOLS=%WORKSPACE%BaseTools
) ) else (
@set EDK_BASETOOLS=%WORKSPACE%\BaseTools
)
if exist %EDK_BASETOOLS% (
set EDK_TOOLS_PATH=%EDK_BASETOOLS%
set EDK_BASETOOLS=
) else (
if defined PACKAGES_PATH (
for %%i IN (%PACKAGES_PATH%) DO (
if exist %%~fi\BaseTools (
set EDK_TOOLS_PATH=%%~fi\BaseTools
goto checkNt32Flag
) )
) else (
echo.
echo !!! ERROR !!! Cannot find BaseTools !!!
echo.
goto BadBaseTools
) )
) else (
echo.
echo !!! ERROR !!! Cannot find BaseTools !!!
echo.
goto BadBaseTools
) )
) )