From 85572ba406b3280d180bf4640821874e8198b0b2 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 1 Aug 2019 08:58:13 -0700 Subject: [PATCH] Add parameter simple to remove .\ from relative path. --- voussoirkit/pathclass.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index 6c1763d..8c9125e 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -126,7 +126,7 @@ class Path: def relative_path(self): return self.relative_to(os.getcwd()) - def relative_to(self, other): + def relative_to(self, other, simple=False): other = Path(other) if self == other: @@ -139,7 +139,8 @@ class Path: relative = self.absolute_path relative = relative.replace(other.absolute_path, '', 1) relative = relative.lstrip(os.sep) - relative = '.' + os.sep + relative + if not simple: + relative = '.' + os.sep + relative return relative common = common_path([other.absolute_path, self.absolute_path], fallback=None)