diff options
author | Yunhua Feng <yunhuax.feng@intel.com> | 2018-08-07 09:35:33 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-08-08 08:44:22 +0800 |
commit | 40d1adb3ebf215bacf89d866fd72bfad897daec3 (patch) | |
tree | c146d7f18f463f98c61daf46c53bb42c055af4a4 | |
parent | b6e48ec6412eab0f21fdff5a045a7ee516574d44 (diff) | |
download | edk2-40d1adb3ebf215bacf89d866fd72bfad897daec3.tar.gz |
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>
-rwxr-xr-x | edksetup.bat | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/edksetup.bat b/edksetup.bat index 97e2330e8c..c32755a471 100755 --- a/edksetup.bat +++ b/edksetup.bat @@ -59,22 +59,33 @@ if /I "%1"=="/help" goto Usage if /I "%1"=="NewBuild" shift
if not defined EDK_TOOLS_PATH (
- if exist %WORKSPACE%\BaseTools (
- set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
- ) else (
- if defined PACKAGES_PATH (
- for %%i IN (%PACKAGES_PATH%) DO (
- if exist %%~fi\BaseTools (
- set EDK_TOOLS_PATH=%%~fi\BaseTools
- goto checkNt32Flag
- )
+ goto SetEdkToolsPath
+) else (
+ goto checkNt32Flag
+)
+
+:SetEdkToolsPath
+if %WORKSPACE:~-1% EQU \ (
+ @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
)
)
|