use Documents/Anki (in English) if no DocumentsLocation

Otherwise it gets created directly in the home folder, which is
confusing when you would expect that only to happen on older installs
which previously used it.
This commit is contained in:
Soren I. Bjornstad 2014-07-22 11:21:39 -05:00
parent 23cec2d5e9
commit 9e69da6c9a

View file

@ -224,7 +224,14 @@ and no other programs are accessing your profile folders, then try again."""))
return p return p
else: else:
loc = QDesktopServices.storageLocation(QDesktopServices.DocumentsLocation) loc = QDesktopServices.storageLocation(QDesktopServices.DocumentsLocation)
return os.path.join(loc, "Anki") if loc[:-1] == QDesktopServices.storageLocation(
QDesktopServices.HomeLocation):
# occasionally "documentsLocation" will return the home
# folder because the Documents folder isn't configured
# properly; fall back to an English path
return os.path.expanduser("~/Documents/Anki")
else:
return os.path.join(loc, "Anki")
def _loadMeta(self): def _loadMeta(self):
path = os.path.join(self.base, "prefs.db") path = os.path.join(self.base, "prefs.db")