mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Handle non-UTF-8 filenames in cache directory when expiring
This commit is contained in:
parent
428957543c
commit
d57626c043
@ -54,8 +54,11 @@ def safe_makedirs(path):
|
|||||||
def robust_rmtree(x):
|
def robust_rmtree(x):
|
||||||
retries = 2 if iswindows else 1 # retry on windows to get around the idiotic mandatory file locking
|
retries = 2 if iswindows else 1 # retry on windows to get around the idiotic mandatory file locking
|
||||||
for i in range(retries):
|
for i in range(retries):
|
||||||
|
try:
|
||||||
try:
|
try:
|
||||||
rmtree(x)
|
rmtree(x)
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
rmtree(as_bytes(x))
|
||||||
return True
|
return True
|
||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user