public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Feng, YunhuaX" <yunhuax.feng@intel.com>
To: "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Zhu, Yonghong" <yonghong.zhu@intel.com>,
	"Gao, Liming" <liming.gao@intel.com>
Subject: [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH%
Date: Tue, 7 Aug 2018 01:35:33 +0000	[thread overview]
Message-ID: <47C64442C08CCD4089DC43B6B5E46BC48B1CCB@shsmsx102.ccr.corp.intel.com> (raw)

For non-root folder, such as "X:\bp", the EDK_TOOLS_PATH will
resolve to "X:\bp\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>
---
 edksetup.bat | 39 +++++++++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/edksetup.bat b/edksetup.bat
index 97e2330e8c..c32755a471 100755
--- a/edksetup.bat
+++ b/edksetup.bat
@@ -57,26 +57,37 @@ if /I "%1"=="/h" goto Usage
 if /I "%1"=="/?" goto Usage
 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
   )
 )
 
 :checkNt32Flag
 if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=%EDK_TOOLS_PATH%
-- 
2.12.2.windows.2



             reply	other threads:[~2018-08-07  1:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07  1:35 Feng, YunhuaX [this message]
2018-08-07  2:20 ` [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH% Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47C64442C08CCD4089DC43B6B5E46BC48B1CCB@shsmsx102.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox