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:
parent
41dd3eb0db
commit
81782383a9
1 changed files with 2 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue