make sure temp folder hasn't been deleted since creation

This commit is contained in:
Soren I. Bjornstad 2014-06-24 14:50:39 -05:00
parent d659d9cff7
commit 72b4148127

View file

@ -292,9 +292,10 @@ def tmpdir():
shutil.rmtree(_tmpdir)
import atexit
atexit.register(cleanup)
_tmpdir = unicode(os.path.join(tempfile.gettempdir(), "anki_temp"), sys.getfilesystemencoding())
if not os.path.exists(_tmpdir):
os.mkdir(_tmpdir)
_tmpdir = unicode(os.path.join(tempfile.gettempdir(), "anki_temp"), \
sys.getfilesystemencoding())
if not os.path.exists(_tmpdir):
os.mkdir(_tmpdir)
return _tmpdir
def tmpfile(prefix="", suffix=""):