MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / NormPath

Function NormPath

BaseTools/Source/Python/Common/StringUtils.py:305–328  ·  view source on GitHub ↗
(Path, Defines=None)

Source from the content-addressed store, hash-verified

303# @retval Path Formatted path
304#
305def NormPath(Path, Defines=None):
306 IsRelativePath = False
307 if Path:
308 if Path[0] == '.':
309 IsRelativePath = True
310 #
311 # Replace with Define
312 #
313 if Defines:
314 Path = ReplaceMacro(Path, Defines)
315 #
316 # To local path format
317 #
318 Path = os.path.normpath(Path)
319 if Path.startswith(GlobalData.gWorkspace) and not Path.startswith(GlobalData.gBuildDirectory) and not os.path.exists(Path):
320 Path = Path[len (GlobalData.gWorkspace):]
321 if Path[0] == os.path.sep:
322 Path = Path[1:]
323 Path = mws.join(GlobalData.gWorkspace, Path)
324
325 if IsRelativePath and Path[0] != '.':
326 Path = os.path.join('.', Path)
327
328 return Path
329
330## CleanString
331#

Callers 15

PreprocessIncludeFileMethod · 0.90
_ParseInfStatementMethod · 0.90
_GetRAWDataMethod · 0.90
_VerifyFileMethod · 0.90
GenFdsApiFunction · 0.90
GenerateGuidXRefFileMethod · 0.90
GenFfsMethod · 0.90
IncludeToolDefFileMethod · 0.90
InstantiateMethod · 0.90

Calls 3

lenFunction · 0.85
joinMethod · 0.80
ReplaceMacroFunction · 0.70

Tested by

no test coverage detected