From c6d74500284c3fe3cb24dc7ba97861ab1a865d59 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 20 Sep 2020 17:31:28 -0700 Subject: [PATCH] Add Path.open. --- voussoirkit/pathclass.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index cdd374d..ba12bed 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -199,6 +199,9 @@ class Path: norm = norm.replace('/', self.sep).replace('\\', self.sep) return norm + def open(self, *args, **kwargs): + return open(self.absolute_path, *args, **kwargs) + @property def parent(self): parent = os.path.dirname(self.absolute_path) @@ -269,7 +272,7 @@ class Path: try: os.utime(self.absolute_path) except FileNotFoundError: - open(self.absolute_path, 'a').close() + self.open('a').close() def walk(self): directories = []