mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
check for valid temp file on startup
This commit is contained in:
parent
f3c3281654
commit
0b80b8bdf5
1 changed files with 11 additions and 1 deletions
|
@ -1,7 +1,7 @@
|
||||||
# Copyright: Damien Elmes <anki@ichi2.net>
|
# Copyright: Damien Elmes <anki@ichi2.net>
|
||||||
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
import os, sys, optparse, atexit, __builtin__
|
import os, sys, optparse, atexit, tempfile, __builtin__
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
import locale, gettext
|
import locale, gettext
|
||||||
import anki.lang
|
import anki.lang
|
||||||
|
@ -191,6 +191,16 @@ def run():
|
||||||
# we've signaled the primary instance, so we should close
|
# we've signaled the primary instance, so we should close
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# we must have a usable temp dir
|
||||||
|
try:
|
||||||
|
tempfile.gettempdir()
|
||||||
|
except:
|
||||||
|
QMessageBox.critical(
|
||||||
|
None, "Error", """\
|
||||||
|
No usable temporary folder found. Make sure C:\\temp exists or TEMP in your \
|
||||||
|
environment points to a valid, writable folder.""")
|
||||||
|
return
|
||||||
|
|
||||||
# parse args
|
# parse args
|
||||||
opts, args = parseArgs(sys.argv)
|
opts, args = parseArgs(sys.argv)
|
||||||
opts.base = unicode(opts.base or "", sys.getfilesystemencoding())
|
opts.base = unicode(opts.base or "", sys.getfilesystemencoding())
|
||||||
|
|
Loading…
Reference in a new issue