This commit is contained in:
Kovid Goyal 2025-04-30 08:02:23 +05:30
parent d11ea450aa
commit 6f79154dbc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -40,10 +40,13 @@ get_default_tempdir = tempfile.gettempdir
def base_dir(): def base_dir():
global _base_dir, _prevent_recursion global _base_dir, _prevent_recursion
if _base_dir is not None and not _prevent_recursion and not os.path.exists(_base_dir): if _base_dir is not None and not os.path.exists(_base_dir):
# Some people seem to think that running temp file cleaners that # Some people seem to think that running temp file cleaners that
# delete the temp dirs of running programs is a good idea! # delete the temp dirs of running programs is a good idea!
_base_dir = None if _prevent_recursion:
_base_dir = get_default_tempdir()
else:
_base_dir = None
if _base_dir is None: if _base_dir is None:
td = os.environ.get('CALIBRE_WORKER_TEMP_DIR', None) td = os.environ.get('CALIBRE_WORKER_TEMP_DIR', None)
if td is not None: if td is not None: