mirror of
https://github.com/ankitects/anki.git
synced 2025-11-10 22:57:11 -05:00
fix handling of corrupt collections on windows
- advise user to create new profile, which prevents restores from backup overwriting old backups - don't rename the collection file, as it's no longer necessary, and it fixes a windows bug where the main window would be left open due to a failure to rename the locked collection file
This commit is contained in:
parent
2aa7714f87
commit
61b0072dcc
1 changed files with 7 additions and 8 deletions
15
aqt/main.py
15
aqt/main.py
|
|
@ -271,14 +271,13 @@ To import into a password protected profile, please open the profile before atte
|
|||
self.col = Collection(cpath, log=True)
|
||||
except anki.db.Error:
|
||||
# warn user
|
||||
showWarning("""\
|
||||
Your collection is corrupt. Please see the manual for \
|
||||
how to restore from a backup."""+"\n\n"+_("Debug info:")+"\n"+traceback.format_exc())
|
||||
# move it out of the way so the profile can be used again
|
||||
newpath = cpath+str(intTime())
|
||||
os.rename(cpath, newpath)
|
||||
# then close
|
||||
sys.exit(1)
|
||||
showWarning(_("""\
|
||||
Your collection is corrupt. Please create a new profile, then \
|
||||
see the manual for how to restore from an automatic backup.
|
||||
|
||||
Debug info:
|
||||
""")+traceback.format_exc())
|
||||
self.unloadProfile()
|
||||
except Exception, e:
|
||||
# the custom exception handler won't catch this if we immediately
|
||||
# unload, so we have to manually handle it
|
||||
|
|
|
|||
Loading…
Reference in a new issue