mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
ToC Editor: Workaround an occasional error when closing on Windows if the file being edited is in a DropBox/antivirus prone area
This commit is contained in:
parent
631bb7652f
commit
0f56a27b97
@ -164,8 +164,14 @@ class ToCEditAction(InterfaceAction):
|
|||||||
result_path = job['path'] + '.result'
|
result_path = job['path'] + '.result'
|
||||||
if job['started'] and os.path.exists(result_path):
|
if job['started'] and os.path.exists(result_path):
|
||||||
self.jobs.remove(job)
|
self.jobs.remove(job)
|
||||||
with open(result_path) as f:
|
ret = -1
|
||||||
ret = int(f.read().strip())
|
|
||||||
|
def read(result_path):
|
||||||
|
nonlocal ret
|
||||||
|
with open(result_path) as f:
|
||||||
|
ret = int(f.read().strip())
|
||||||
|
|
||||||
|
retry_on_fail(read, result_path)
|
||||||
retry_on_fail(os.remove, result_path)
|
retry_on_fail(os.remove, result_path)
|
||||||
if ret == 0:
|
if ret == 0:
|
||||||
db = self.gui.current_db
|
db = self.gui.current_db
|
||||||
|
Loading…
x
Reference in New Issue
Block a user