mirror of
https://github.com/beetbox/beets.git
synced 2025-12-25 10:05:13 +01:00
Catch OSError in prune_dirs
Since `fnmatch_all` can raise `OSError`s, and we were already silently giving up in `prune_dirs` on some of these exception, just do more of the same.
This commit is contained in:
parent
ebed21f319
commit
dc897c0bb9
1 changed files with 5 additions and 5 deletions
|
|
@ -283,13 +283,13 @@ def prune_dirs(path, root=None, clutter=('.DS_Store', 'Thumbs.db')):
|
|||
continue
|
||||
clutter = [bytestring_path(c) for c in clutter]
|
||||
match_paths = [bytestring_path(d) for d in os.listdir(directory)]
|
||||
if fnmatch_all(match_paths, clutter):
|
||||
# Directory contains only clutter (or nothing).
|
||||
try:
|
||||
try:
|
||||
if fnmatch_all(match_paths, clutter):
|
||||
# Directory contains only clutter (or nothing).
|
||||
shutil.rmtree(directory)
|
||||
except OSError:
|
||||
else:
|
||||
break
|
||||
else:
|
||||
except OSError:
|
||||
break
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue