mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Replace pathlib.glob() with os.scandir() in fs.py
This commit is contained in:
parent
50f5db1543
commit
43fcc52291
@ -377,7 +377,8 @@ class Folder(File):
|
||||
@property
|
||||
def subfolders(self):
|
||||
if self._subfolders is None:
|
||||
subfolders = [p for p in self.path.glob("*") if not p.is_symlink() and p.is_dir()]
|
||||
with os.scandir(self.path) as iter:
|
||||
subfolders = [p.path for p in iter if not p.is_symlink() and p.is_dir()]
|
||||
self._subfolders = [self.__class__(p) for p in subfolders]
|
||||
return self._subfolders
|
||||
|
||||
@ -410,8 +411,9 @@ def get_files(path, fileclasses=[File]):
|
||||
assert all(issubclass(fileclass, File) for fileclass in fileclasses)
|
||||
try:
|
||||
result = []
|
||||
for path in path.glob("*"):
|
||||
file = get_file(path, fileclasses=fileclasses)
|
||||
with os.scandir(path) as iter:
|
||||
for item in iter:
|
||||
file = get_file(item, fileclasses=fileclasses)
|
||||
if file is not None:
|
||||
result.append(file)
|
||||
return result
|
||||
|
Loading…
x
Reference in New Issue
Block a user