mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-27 09:16:23 +01: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
1 changed files with 6 additions and 1 deletions
|
|
@ -1338,7 +1338,12 @@ def format_abspath(self, book_id, fmt, fname, path):
|
|||
except: # If path contains strange characters this throws an exc
|
||||
candidates = []
|
||||
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
|
||||
|
||||
def cover_abspath(self, book_id, path):
|
||||
|
|
|
|||
Loading…
Reference in a new issue