summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Common/String.py
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/Common/String.py')
-rw-r--r--BaseTools/Source/Python/Common/String.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py
index 6c9671d514..5c8d1e0ded 100644
--- a/BaseTools/Source/Python/Common/String.py
+++ b/BaseTools/Source/Python/Common/String.py
@@ -24,6 +24,7 @@ import GlobalData
from BuildToolError import *
from CommonDataClass.Exceptions import *
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
@@ -305,6 +306,11 @@ def NormPath(Path, Defines={}):
# To local path format
#
Path = os.path.normpath(Path)
+ if Path.startswith(GlobalData.gWorkspace) and not os.path.exists(Path):
+ Path = Path[len (GlobalData.gWorkspace):]
+ if Path[0] == os.path.sep:
+ Path = Path[1:]
+ Path = mws.join(GlobalData.gWorkspace, Path)
if IsRelativePath and Path[0] != '.':
Path = os.path.join('.', Path)
@@ -702,7 +708,7 @@ def RaiseParserError(Line, Section, File, Format='', LineNo= -1):
# @retval string A full path
#
def WorkspaceFile(WorkspaceDir, Filename):
- return os.path.join(NormPath(WorkspaceDir), NormPath(Filename))
+ return mws.join(NormPath(WorkspaceDir), NormPath(Filename))
## Split string
#