mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Windows: Generate catalog: Workaround for systems where a broken antivirus or similar holds open files in the catalog library causing a permission denied error. Fixes #2115084 [Create Catalog fails](https://bugs.launchpad.net/calibre/+bug/2115084)
This commit is contained in:
parent
ea7e12d0f1
commit
fb4654bd91
@ -5,6 +5,7 @@ __docformat__ = 'restructuredtext en'
|
||||
import os
|
||||
from optparse import OptionParser
|
||||
|
||||
from calibre.constants import iswindows
|
||||
from calibre.customize.conversion import DummyReporter, OptionRecommendation
|
||||
from calibre.customize.ui import plugin_for_catalog_format
|
||||
from calibre.ebooks.conversion.plumber import Plumber
|
||||
@ -80,6 +81,10 @@ def gui_catalog(library_path, temp_db_path, fmt, title, dbspec, ids, out_file_na
|
||||
plugin = plugin_for_catalog_format(fmt)
|
||||
return plugin.run(out_file_name, opts, db, notification=notification)
|
||||
finally:
|
||||
import shutil
|
||||
db.close()
|
||||
shutil.rmtree(os.path.dirname(temp_db_path))
|
||||
from calibre.db.backend import rmtree_with_retry
|
||||
try:
|
||||
rmtree_with_retry(temp_db_path)
|
||||
except PermissionError:
|
||||
if not iswindows: # probably some antivirus holding a file open, the folder will be deleted on exit anyway
|
||||
raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user