mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -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.db = None
|
||||
# instantiate base folder
|
||||
if base:
|
||||
self.base = os.path.abspath(base)
|
||||
else:
|
||||
self.base = self._defaultBase()
|
||||
self.maybeMigrateFolder()
|
||||
self.ensureBaseExists()
|
||||
self._setBaseFolder(base)
|
||||
# load metadata
|
||||
self.firstRun = self._loadMeta()
|
||||
# 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)
|
||||
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):
|
||||
if isWin:
|
||||
loc = QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)
|
||||
|
|
Loading…
Reference in a new issue