]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/String.py
BaseTools: Update Build tool to support multiple workspaces
[mirror_edk2.git] / BaseTools / Source / Python / Common / String.py
index 6c9671d5142235f24688e4f745349e2d4d63fdd1..5c8d1e0ded5b86b0463b0d31a1a7776e9f2a493a 100644 (file)
@@ -24,6 +24,7 @@ import GlobalData
 from BuildToolError import *\r
 from CommonDataClass.Exceptions import *\r
 from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
 \r
 gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)\r
 gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')\r
@@ -305,6 +306,11 @@ def NormPath(Path, Defines={}):
         # To local path format\r
         #\r
         Path = os.path.normpath(Path)\r
+        if Path.startswith(GlobalData.gWorkspace) and not os.path.exists(Path):\r
+            Path = Path[len (GlobalData.gWorkspace):]\r
+            if Path[0] == os.path.sep:\r
+                Path = Path[1:]\r
+            Path = mws.join(GlobalData.gWorkspace, Path)\r
 \r
     if IsRelativePath and Path[0] != '.':\r
         Path = os.path.join('.', Path)\r
@@ -702,7 +708,7 @@ def RaiseParserError(Line, Section, File, Format='', LineNo= -1):
 # @retval string A full path\r
 #\r
 def WorkspaceFile(WorkspaceDir, Filename):\r
-    return os.path.join(NormPath(WorkspaceDir), NormPath(Filename))\r
+    return mws.join(NormPath(WorkspaceDir), NormPath(Filename))\r
 \r
 ## Split string\r
 #\r