From 478c164bf971cdf1e18a8b2a707abdfab956fa91 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 13 Jan 2017 21:11:39 +1000 Subject: [PATCH] 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 --- aqt/profiles.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aqt/profiles.py b/aqt/profiles.py index 743b2e546..d72b0fb98 100644 --- a/aqt/profiles.py +++ b/aqt/profiles.py @@ -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 ######################################################################