summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2020-09-25 17:08:09 +0000
committerChristoph Reiter <reiter.christoph@gmail.com>2020-09-25 17:08:09 +0000
commit4d9cd54f8d110b5369a999f43dd88a8d2217698c (patch)
tree65d3a3269d5d2710ca1b9cce928ae9385fc38068
parent16e48ae52be3925dc22545f16469880c168baa1c (diff)
parent95028675e877d7c4b2604f13113ac6b552f8b902 (diff)
downloadgobject-introspection-4d9cd54f8d110b5369a999f43dd88a8d2217698c.tar.gz
Merge branch 'fix.win.cmd.3-38' into 'gnome-3-38'
gicsanner/message.py: Windows: Fix running on different drives See merge request GNOME/gobject-introspection!239
-rw-r--r--giscanner/message.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/giscanner/message.py b/giscanner/message.py
index 9057c23c..24f1b7df 100644
--- a/giscanner/message.py
+++ b/giscanner/message.py
@@ -75,8 +75,14 @@ class Position(object):
self.column or -1)
def format(self, cwd):
- filename = os.path.relpath(os.path.realpath(self.filename),
- os.path.realpath(cwd))
+ # Windows: We may be using different drives self.filename and cwd,
+ # which leads to a ValuError when using os.path.relpath().
+ # In that case, just use the entire path of self.filename
+ try:
+ filename = os.path.relpath(os.path.realpath(self.filename),
+ os.path.realpath(cwd))
+ except ValueError:
+ filename = os.path.realpath(self.filename)
if self.column is not None:
return '%s:%d:%d' % (filename, self.line, self.column)