Use os.path.relpath to get the relative directory instead of directly trim it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <[email protected]>
---
 BaseTools/Source/Python/Common/MultipleWorkspace.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Common/MultipleWorkspace.py 
b/BaseTools/Source/Python/Common/MultipleWorkspace.py
index 8088404..feb1f8d 100644
--- a/BaseTools/Source/Python/Common/MultipleWorkspace.py
+++ b/BaseTools/Source/Python/Common/MultipleWorkspace.py
@@ -41,7 +41,7 @@ class MultipleWorkspace(object):
     @classmethod
     def convertPackagePath(cls, Ws, Path):
         if str(os.path.normcase (Path)).startswith(Ws):
-            return os.path.join(Ws, Path[len(Ws) + 1:])
+            return os.path.join(Ws, os.path.relpath(Path, Ws))
         return Path
 
     ## setWs()
-- 
1.9.5.msysgit.0

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to