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)
|
self.col = Collection(cpath, log=True)
|
||||||
except anki.db.Error:
|
except anki.db.Error:
|
||||||
# warn user
|
# warn user
|
||||||
showWarning("""\
|
showWarning(_("""\
|
||||||
Your collection is corrupt. Please see the manual for \
|
Your collection is corrupt. Please create a new profile, then \
|
||||||
how to restore from a backup."""+"\n\n"+_("Debug info:")+"\n"+traceback.format_exc())
|
see the manual for how to restore from an automatic backup.
|
||||||
# move it out of the way so the profile can be used again
|
|
||||||
newpath = cpath+str(intTime())
|
Debug info:
|
||||||
os.rename(cpath, newpath)
|
""")+traceback.format_exc())
|
||||||
# then close
|
self.unloadProfile()
|
||||||
sys.exit(1)
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
# the custom exception handler won't catch this if we immediately
|
# the custom exception handler won't catch this if we immediately
|
||||||
# unload, so we have to manually handle it
|
# unload, so we have to manually handle it
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue