Small improvement for the profiler.format_fname method to make it work on windows (hopefully).

This commit is contained in:
mvantellingen
2011-02-06 23:13:51 +01:00
parent cee7783ff8
commit e591b3c97a
+5 -3
View File
@@ -115,9 +115,11 @@ def format_fname(value):
# If the value is not an absolute path, the it is a builtin or
# a relative file (thus a project file).
if not os.path.isabs(value):
if value.startswith('{'):
if value.startswith(('{', '<')):
return value
return './' + value
if value.startswith('.' + os.path.sep):
return value
return '.' + os.path.sep + value
# If the file is absolute and within the project root handle it as
# a project file
@@ -135,7 +137,7 @@ def format_fname(value):
prefix = new_prefix
prefix_len = len(prefix)
if not prefix.endswith('/'):
if not prefix.endswith(os.path.sep):
prefix_len -= 1
path = value[prefix_len:]
return '<%s>' % path