Let pathclass.join take spawn_kwargs.

master
voussoir 2021-11-07 18:55:28 -08:00
parent 154f02f5bb
commit 125681da18
No known key found for this signature in database
GPG Key ID: 5F7554F8C26DACCB
1 changed files with 4 additions and 4 deletions

View File

@ -242,6 +242,7 @@ class Path:
def is_directory(self):
return os.path.isdir(self.absolute_path)
# Aliases for your convenience.
is_dir = is_directory
is_folder = is_directory
@ -253,16 +254,15 @@ class Path:
def is_link(self):
return os.path.islink(self.absolute_path)
def join(self, subpath):
def join(self, subpath, **spawn_kwargs):
if not isinstance(subpath, str):
raise TypeError('subpath must be a string')
path = os.path.join(self.absolute_path, subpath)
return self.spawn(path)
return self.spawn(path, **spawn_kwargs)
def listdir(self):
children = os.listdir(self.absolute_path)
children = [os.path.join(self.absolute_path, child) for child in children]
children = [self.spawn(child, _case_correct=self._case_correct) for child in children]
children = [self.join(child, _case_correct=self._case_correct) for child in children]
return children
def makedirs(self, mode=0o777, exist_ok=False):