mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 23:27:12 -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):
|
||||
p = self._oldConfigPath()
|
||||
# does an old config file exist?
|
||||
if not os.path.exists(p):
|
||||
if not p or not os.path.exists(p):
|
||||
return
|
||||
# load old settings and copy over
|
||||
try:
|
||||
|
|
@ -38,7 +38,11 @@ to import your decks from previous Anki versions."""))
|
|||
|
||||
def _oldConfigPath(self):
|
||||
if isWin:
|
||||
os.environ['HOME'] = os.environ['APPDATA']
|
||||
try:
|
||||
os.environ['HOME'] = os.environ['APPDATA']
|
||||
except:
|
||||
# system with %APPDATA% not defined
|
||||
return None
|
||||
p = "~/.anki/config.db"
|
||||
elif isMac:
|
||||
p = "~/Library/Application Support/Anki/config.db"
|
||||
|
|
|
|||
Loading…
Reference in a new issue