diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index 2593e0f..b33cc93 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -64,6 +64,12 @@ class Path: if not self.is_dir: raise NotDirectory(self) + def add_extension(self, extension): + extension = extension.strip('.') + if extension == '': + return self + return Path(self.absolute_path + '.' + extension) + @property def basename(self): return os.path.basename(self.absolute_path)