mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
fix race condition in tmp folder handling
This commit is contained in:
parent
59ec442317
commit
af4d4af55d
1 changed files with 3 additions and 1 deletions
|
@ -305,8 +305,10 @@ def tmpdir() -> Any:
|
||||||
import atexit
|
import atexit
|
||||||
atexit.register(cleanup)
|
atexit.register(cleanup)
|
||||||
_tmpdir = os.path.join(tempfile.gettempdir(), "anki_temp")
|
_tmpdir = os.path.join(tempfile.gettempdir(), "anki_temp")
|
||||||
if not os.path.exists(_tmpdir):
|
try:
|
||||||
os.mkdir(_tmpdir)
|
os.mkdir(_tmpdir)
|
||||||
|
except FileExistsError:
|
||||||
|
pass
|
||||||
return _tmpdir
|
return _tmpdir
|
||||||
|
|
||||||
def tmpfile(prefix: str = "", suffix: str = "") -> Any:
|
def tmpfile(prefix: str = "", suffix: str = "") -> Any:
|
||||||
|
|
Loading…
Reference in a new issue