mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
use 'Library/Application Support' to match 2.0.x
This commit is contained in:
parent
864fbdf469
commit
a76c6a1bcf
1 changed files with 19 additions and 1 deletions
|
@ -9,6 +9,8 @@
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import pickle
|
import pickle
|
||||||
|
import shutil
|
||||||
|
|
||||||
import locale
|
import locale
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
@ -68,6 +70,7 @@ class ProfileManager(object):
|
||||||
self.base = os.path.abspath(base)
|
self.base = os.path.abspath(base)
|
||||||
else:
|
else:
|
||||||
self.base = self._defaultBase()
|
self.base = self._defaultBase()
|
||||||
|
self.maybeMigrateFolder()
|
||||||
self.ensureBaseExists()
|
self.ensureBaseExists()
|
||||||
# load metadata
|
# load metadata
|
||||||
self.firstRun = self._loadMeta()
|
self.firstRun = self._loadMeta()
|
||||||
|
@ -97,6 +100,21 @@ issue, please see the documentation for information on running Anki from \
|
||||||
a flash drive.""" % self.base)
|
a flash drive.""" % self.base)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
# Folder migration
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
def maybeMigrateFolder(self):
|
||||||
|
if not isMac:
|
||||||
|
return
|
||||||
|
oldBase = os.path.expanduser("~/Documents/Anki")
|
||||||
|
|
||||||
|
if not os.path.exists(self.base) and os.path.exists(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
|
# Profile load/save
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
@ -213,7 +231,7 @@ and no other programs are accessing your profile folders, then try again."""))
|
||||||
loc = QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)
|
loc = QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)
|
||||||
return os.path.join(loc, "Anki")
|
return os.path.join(loc, "Anki")
|
||||||
elif isMac:
|
elif isMac:
|
||||||
return os.path.expanduser("~/Documents/Anki")
|
return os.path.expanduser("~/Library/Application Support/Anki2")
|
||||||
else:
|
else:
|
||||||
# use Documents/Anki on new installs, ~/Anki on existing ones
|
# use Documents/Anki on new installs, ~/Anki on existing ones
|
||||||
p = os.path.expanduser("~/Anki")
|
p = os.path.expanduser("~/Anki")
|
||||||
|
|
Loading…
Reference in a new issue