Commit f8f64ff3 authored by robertwb's avatar robertwb

Merge pull request #55 from schmir/relative-paths

report filenames relative to the current directory or as absolute paths i
parents 08ff9237 d258829d
...@@ -32,7 +32,7 @@ def context(position): ...@@ -32,7 +32,7 @@ def context(position):
def format_position(position): def format_position(position):
if position: if position:
return u"%s:%d:%d: " % (position[0].get_description(), return u"%s:%d:%d: " % (position[0].get_error_description(),
position[1], position[2]) position[1], position[2])
return u'' return u''
......
...@@ -204,6 +204,13 @@ class FileSourceDescriptor(SourceDescriptor): ...@@ -204,6 +204,13 @@ class FileSourceDescriptor(SourceDescriptor):
def get_description(self): def get_description(self):
return self.path_description return self.path_description
def get_error_description(self):
path = self.filename
cwd = os.getcwd() + os.path.sep
if path.startswith(cwd):
return path[len(cwd):]
return path
def get_filenametable_entry(self): def get_filenametable_entry(self):
return self.filename return self.filename
...@@ -239,6 +246,8 @@ class StringSourceDescriptor(SourceDescriptor): ...@@ -239,6 +246,8 @@ class StringSourceDescriptor(SourceDescriptor):
def get_description(self): def get_description(self):
return self.name return self.name
get_error_description = get_description
def get_filenametable_entry(self): def get_filenametable_entry(self):
return "stringsource" return "stringsource"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment