mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 07:37:11 -05:00
don't die if appdata not defined
This commit is contained in:
parent
8b0fc36b29
commit
4f738fd8cf
1 changed files with 6 additions and 2 deletions
|
|
@ -18,7 +18,7 @@ class Upgrader(object):
|
||||||
def maybeUpgrade(self):
|
def maybeUpgrade(self):
|
||||||
p = self._oldConfigPath()
|
p = self._oldConfigPath()
|
||||||
# does an old config file exist?
|
# does an old config file exist?
|
||||||
if not os.path.exists(p):
|
if not p or not os.path.exists(p):
|
||||||
return
|
return
|
||||||
# load old settings and copy over
|
# load old settings and copy over
|
||||||
try:
|
try:
|
||||||
|
|
@ -38,7 +38,11 @@ to import your decks from previous Anki versions."""))
|
||||||
|
|
||||||
def _oldConfigPath(self):
|
def _oldConfigPath(self):
|
||||||
if isWin:
|
if isWin:
|
||||||
|
try:
|
||||||
os.environ['HOME'] = os.environ['APPDATA']
|
os.environ['HOME'] = os.environ['APPDATA']
|
||||||
|
except:
|
||||||
|
# system with %APPDATA% not defined
|
||||||
|
return None
|
||||||
p = "~/.anki/config.db"
|
p = "~/.anki/config.db"
|
||||||
elif isMac:
|
elif isMac:
|
||||||
p = "~/Library/Application Support/Anki/config.db"
|
p = "~/Library/Application Support/Anki/config.db"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue