Fix #1519855 [restore database without metadata.db present in directory fails](https://bugs.launchpad.net/calibre/+bug/1519855)

This commit is contained in:
Kovid Goyal 2015-11-25 20:43:41 +05:30
parent c63d75bae4
commit 30c4d00d9b

View File

@ -269,6 +269,7 @@ class Restore(Thread):
save_path = self.olddb = os.path.splitext(dbpath)[0]+'_pre_restore.db'
if os.path.exists(save_path):
os.remove(save_path)
if os.path.exists(dbpath):
try:
os.rename(dbpath, save_path)
except EnvironmentError: