mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
allow setting base via env var
This commit is contained in:
parent
4430785122
commit
88d8be32d9
1 changed files with 11 additions and 6 deletions
|
@ -66,12 +66,7 @@ class ProfileManager:
|
||||||
self.name = None
|
self.name = None
|
||||||
self.db = None
|
self.db = None
|
||||||
# instantiate base folder
|
# instantiate base folder
|
||||||
if base:
|
self._setBaseFolder(base)
|
||||||
self.base = os.path.abspath(base)
|
|
||||||
else:
|
|
||||||
self.base = self._defaultBase()
|
|
||||||
self.maybeMigrateFolder()
|
|
||||||
self.ensureBaseExists()
|
|
||||||
# load metadata
|
# load metadata
|
||||||
self.firstRun = self._loadMeta()
|
self.firstRun = self._loadMeta()
|
||||||
# did the user request a profile to start up with?
|
# did the user request a profile to start up with?
|
||||||
|
@ -226,6 +221,16 @@ and no other programs are accessing your profile folders, then try again."""))
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
def _setBaseFolder(self, cmdlineBase):
|
||||||
|
if cmdlineBase:
|
||||||
|
self.base = os.path.abspath(cmdlineBase)
|
||||||
|
elif os.environ.get("ANKI_BASE"):
|
||||||
|
self.base = os.path.abspath(os.environ["ANKI_BASE"])
|
||||||
|
else:
|
||||||
|
self.base = self._defaultBase()
|
||||||
|
self.maybeMigrateFolder()
|
||||||
|
self.ensureBaseExists()
|
||||||
|
|
||||||
def _defaultBase(self):
|
def _defaultBase(self):
|
||||||
if isWin:
|
if isWin:
|
||||||
loc = QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)
|
loc = QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)
|
||||||
|
|
Loading…
Reference in a new issue