make sure we don't rename to existing prefs.db.broken

This commit is contained in:
Damien Elmes 2014-07-07 10:47:57 +09:00
parent 760e16dfbf
commit bbefeb0cfd

View File

@ -231,7 +231,10 @@ and no other programs are accessing your profile folders, then try again."""))
new = not os.path.exists(path)
def recover():
# if we can't load profile, start with a new one
os.rename(path, path+".broken")
broken = path+".broken"
if os.path.exists(broken):
os.unlink(broken)
os.rename(path, broken)
QMessageBox.warning(
None, "Preferences Corrupt", """\
Anki's prefs.db file was corrupt and has been recreated. If you were using multiple \