Let listdir spawn children with _correct_case already set.
This commit is contained in:
parent
adf7353ae6
commit
426da9b52b
1 changed files with 4 additions and 5 deletions
|
@ -195,7 +195,8 @@ class Path:
|
||||||
|
|
||||||
def listdir(self):
|
def listdir(self):
|
||||||
children = os.listdir(self.absolute_path)
|
children = os.listdir(self.absolute_path)
|
||||||
children = [self.with_child(child) for child in children]
|
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]
|
||||||
return children
|
return children
|
||||||
|
|
||||||
def makedirs(self, mode=0o777, exist_ok=False):
|
def makedirs(self, mode=0o777, exist_ok=False):
|
||||||
|
@ -220,8 +221,6 @@ class Path:
|
||||||
return self.relative_to(os.getcwd())
|
return self.relative_to(os.getcwd())
|
||||||
|
|
||||||
def relative_to(self, other, simple=False):
|
def relative_to(self, other, simple=False):
|
||||||
other = self.spawn(other)
|
|
||||||
|
|
||||||
if self == other:
|
if self == other:
|
||||||
return '.'
|
return '.'
|
||||||
|
|
||||||
|
@ -269,8 +268,8 @@ class Path:
|
||||||
elif self.is_dir:
|
elif self.is_dir:
|
||||||
return sum(file.size for file in self.walk() if file.is_file)
|
return sum(file.size for file in self.walk() if file.is_file)
|
||||||
|
|
||||||
def spawn(self, path):
|
def spawn(self, path, **kwargs):
|
||||||
return self.__class__(path, force_sep=self.force_sep)
|
return self.__class__(path, force_sep=self.force_sep, **kwargs)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def stat(self):
|
def stat(self):
|
||||||
|
|
Loading…
Reference in a new issue