From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=yunhuax.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D4F8A21BADAB9 for ; Mon, 6 Aug 2018 18:36:23 -0700 (PDT) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2018 18:36:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,453,1526367600"; d="dat'59?scan'59,208,59";a="81229075" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 06 Aug 2018 18:36:22 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 6 Aug 2018 18:36:21 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 6 Aug 2018 18:36:21 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.226]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.143]) with mapi id 14.03.0319.002; Tue, 7 Aug 2018 09:35:33 +0800 From: "Feng, YunhuaX" To: "edk2-devel@lists.01.org" CC: "Zhu, Yonghong" , "Gao, Liming" Thread-Topic: [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH% Thread-Index: AdQt7uBx6pLdqIY/Rm+TTQhHCukB+Q== Date: Tue, 7 Aug 2018 01:35:33 +0000 Message-ID: <47C64442C08CCD4089DC43B6B5E46BC48B1CCB@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <47C64442C08CCD4089DC43B6B5E46BC48B1CCB@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.27 Subject: [PATCH] BaseTools:Fix incorrect %EDK_TOOLS_PATH% X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Aug 2018 01:36:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- 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"=3D=3D"/h" goto Usage if /I "%1"=3D=3D"/?" goto Usage if /I "%1"=3D=3D"/help" goto Usage =20 if /I "%1"=3D=3D"NewBuild" shift if not defined EDK_TOOLS_PATH ( - if exist %WORKSPACE%\BaseTools ( - set EDK_TOOLS_PATH=3D%WORKSPACE%\BaseTools - ) else ( - if defined PACKAGES_PATH ( - for %%i IN (%PACKAGES_PATH%) DO ( - if exist %%~fi\BaseTools ( - set EDK_TOOLS_PATH=3D%%~fi\BaseTools - goto checkNt32Flag - ) + goto SetEdkToolsPath +) else ( + goto checkNt32Flag +) + +:SetEdkToolsPath +if %WORKSPACE:~-1% EQU \ ( + @set EDK_BASETOOLS=3D%WORKSPACE%BaseTools +) else ( + @set EDK_BASETOOLS=3D%WORKSPACE%\BaseTools +) +if exist %EDK_BASETOOLS% ( + set EDK_TOOLS_PATH=3D%EDK_BASETOOLS% + set EDK_BASETOOLS=3D +) else ( + if defined PACKAGES_PATH ( + for %%i IN (%PACKAGES_PATH%) DO ( + if exist %%~fi\BaseTools ( + set EDK_TOOLS_PATH=3D%%~fi\BaseTools + goto checkNt32Flag ) - ) else ( - echo. - echo !!! ERROR !!! Cannot find BaseTools !!! - echo. - goto BadBaseTools ) + ) else ( + echo. + echo !!! ERROR !!! Cannot find BaseTools !!! + echo. + goto BadBaseTools ) ) =20 :checkNt32Flag if exist %EDK_TOOLS_PATH%\Source set BASE_TOOLS_PATH=3D%EDK_TOOLS_PATH% --=20 2.12.2.windows.2