mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Be a bit more robust against external software messing with files in the library folder
This commit is contained in:
parent
bfedab34b8
commit
7c5abc873e
@ -1338,7 +1338,12 @@ class DB(object):
|
|||||||
except: # If path contains strange characters this throws an exc
|
except: # If path contains strange characters this throws an exc
|
||||||
candidates = []
|
candidates = []
|
||||||
if fmt and candidates and os.path.exists(candidates[0]):
|
if fmt and candidates and os.path.exists(candidates[0]):
|
||||||
shutil.copyfile(candidates[0], fmt_path)
|
try:
|
||||||
|
shutil.copyfile(candidates[0], fmt_path)
|
||||||
|
except shutil.SameFileError:
|
||||||
|
# some other process synced in the file since the last
|
||||||
|
# os.path.exists()
|
||||||
|
return candidates[0]
|
||||||
return fmt_path
|
return fmt_path
|
||||||
|
|
||||||
def cover_abspath(self, book_id, path):
|
def cover_abspath(self, book_id, path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user