Use regular path.join when constructing glob patterns.

I don't like the idea of having an intermediate Path object that isn't
a real path.
This commit is contained in:
voussoir 2021-08-09 08:35:54 -07:00
parent 41dd3eb0db
commit 81782383a9
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -42,7 +42,6 @@ class NotFile(PathclassException):
class NotLink(PathclassException):
pass
class Extension:
def __init__(self, ext):
if isinstance(ext, Extension):
@ -82,7 +81,6 @@ class Extension:
return ''
return '.' + self.ext
class Path:
'''
I started to use pathlib.Path, but it was too much of a pain.
@ -208,8 +206,8 @@ class Path:
# If the user wants to glob names in a different path, they should
# create a Pathclass for that directory first and do it normally.
raise TypeError('glob pattern should not have path separators')
pattern = self.with_child(pattern)
children = winglob.glob(pattern.absolute_path)
pattern = os.path.join(self.absolute_path, pattern)
children = winglob.glob(pattern)
children = [self.with_child(child) for child in children]
return children
@ -337,7 +335,6 @@ class Path:
def with_child(self, basename):
return self.join(os.path.basename(basename))
def common_path(paths, fallback):
'''
Given a list of file paths, determine the deepest path which all