Add method Path.add_extension.
This commit is contained in:
parent
b8aaecd15f
commit
6a34c8eae9
1 changed files with 6 additions and 0 deletions
|
@ -64,6 +64,12 @@ class Path:
|
||||||
if not self.is_dir:
|
if not self.is_dir:
|
||||||
raise NotDirectory(self)
|
raise NotDirectory(self)
|
||||||
|
|
||||||
|
def add_extension(self, extension):
|
||||||
|
extension = extension.strip('.')
|
||||||
|
if extension == '':
|
||||||
|
return self
|
||||||
|
return Path(self.absolute_path + '.' + extension)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def basename(self):
|
def basename(self):
|
||||||
return os.path.basename(self.absolute_path)
|
return os.path.basename(self.absolute_path)
|
||||||
|
|
Loading…
Reference in a new issue