mirror of
https://github.com/beetbox/beets.git
synced 2026-01-10 18:07:00 +01:00
Merge pull request #3209 from arcresu/prune_dirs-except
Catch OSError in prune_dirs helper
This commit is contained in:
commit
bb1613694b
2 changed files with 7 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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -195,6 +195,8 @@ Fixes:
|
|||
is long.
|
||||
Thanks to :user:`ray66`.
|
||||
:bug:`3207` :bug:`2752`
|
||||
* Fix an unhandled exception when pruning empty directories.
|
||||
:bug:`1996` :bug:`3209`
|
||||
|
||||
.. _python-itunes: https://github.com/ocelma/python-itunes
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue