(Path, Defines=None)
| 303 | # @retval Path Formatted path |
| 304 | # |
| 305 | def 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 | # |
no test coverage detected