]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/MultipleWorkspace.py
BaseTools: Replace StandardError with Expression
[mirror_edk2.git] / BaseTools / Source / Python / Common / MultipleWorkspace.py
index 4e4c37ae131793783ac7d2cdb304c7f575b3638e..2a76d49cc627ad6cd96ceef1818cb2a7d215f184 100644 (file)
@@ -131,13 +131,16 @@ class MultipleWorkspace(object):
             PathList = PathStr.split()\r
             if PathList:\r
                 for i, str in enumerate(PathList):\r
-                    if str.find(TAB_WORKSPACE) != -1:\r
-                        MacroStartPos = str.find(TAB_WORKSPACE)\r
-                        MacroEndPos = str.find(')', MacroStartPos)\r
-                        Substr = str[MacroEndPos+1:]\r
-                        if Substr.startswith('/') or Substr.startswith('\\'):\r
-                            Substr = Substr[1:]\r
-                        PathList[i] = str[0:MacroStartPos] + os.path.normpath(cls.join(cls.WORKSPACE, Substr))\r
+                    MacroStartPos = str.find(TAB_WORKSPACE)\r
+                    if MacroStartPos != -1:\r
+                        Substr = str[MacroStartPos:]\r
+                        Path = Substr.replace(TAB_WORKSPACE, cls.WORKSPACE).strip()\r
+                        if not os.path.exists(Path):\r
+                            for Pkg in cls.PACKAGES_PATH:\r
+                                Path = Substr.replace(TAB_WORKSPACE, Pkg).strip()\r
+                                if os.path.exists(Path):\r
+                                    break\r
+                        PathList[i] = str[0:MacroStartPos] + Path\r
             PathStr = ' '.join(PathList)\r
         return PathStr\r
     \r