From d9d10a843eb9ec43cbfe6f68669e0557cc2c3bbc Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 1 Aug 2019 08:57:18 -0700 Subject: [PATCH] Fix relative backsteps. --- voussoirkit/pathclass.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index b33cc93..6c1763d 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -149,7 +149,10 @@ class Path: backsteps = other.depth - common.depth backsteps = os.sep.join('..' for x in range(backsteps)) - unique = self.absolute_path.replace(common.absolute_path, '') + common = common.absolute_path + if not common.endswith(os.sep): + common += os.sep + unique = self.absolute_path.replace(common, '', 1) return os.path.join(backsteps, unique) def replace_extension(self, extension):