mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
Fix errors caused by .DS_Store files inserted into the .caltrash directory on macOS if the user happens to open .caltrash in Finder. Fixes #2037237 [NotADirectoryError when merging books on MacOS](https://bugs.launchpad.net/calibre/+bug/2037237)
This commit is contained in:
parent
3d045fb230
commit
7bde152ed3
@ -2040,13 +2040,14 @@ class DB:
|
|||||||
for base in ('b', 'f'):
|
for base in ('b', 'f'):
|
||||||
base = os.path.join(self.trash_dir, base)
|
base = os.path.join(self.trash_dir, base)
|
||||||
for x in os.scandir(base):
|
for x in os.scandir(base):
|
||||||
try:
|
if x.is_dir(follow_symlinks=False):
|
||||||
st = x.stat(follow_symlinks=False)
|
try:
|
||||||
mtime = st.st_mtime
|
st = x.stat(follow_symlinks=False)
|
||||||
except OSError:
|
mtime = st.st_mtime
|
||||||
mtime = 0
|
except OSError:
|
||||||
if mtime + expire_age_in_seconds <= now or expire_age_in_seconds <= 0:
|
mtime = 0
|
||||||
removals.append(x.path)
|
if mtime + expire_age_in_seconds <= now or expire_age_in_seconds <= 0:
|
||||||
|
removals.append(x.path)
|
||||||
for x in removals:
|
for x in removals:
|
||||||
try:
|
try:
|
||||||
rmtree_with_retry(x)
|
rmtree_with_retry(x)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user