fix crash when documents folder on separate filesystem

also get rid of the Documents/Anki symlink, as the symlink doesn't
sync across systems, and is liable to cause confusion in the future
This commit is contained in:
Damien Elmes 2017-01-13 21:11:39 +10:00
parent 0cb983d2f4
commit 478c164bf9

View file

@ -11,6 +11,7 @@ import random
import cPickle
import locale
import re
import shutil
from aqt.qt import *
from anki.db import DB
@ -104,8 +105,11 @@ a flash drive.""" % self.base)
return
oldBase = os.path.expanduser("~/Documents/Anki")
if not os.path.exists(self.base) and os.path.exists(oldBase):
os.rename(oldBase, self.base)
os.symlink(self.base, oldBase)
shutil.move(oldBase, self.base)
# remove the old symlink if it exists
if os.path.exists(oldBase) and os.path.islink(oldBase):
os.remove(oldBase)
# Profile load/save
######################################################################