From 6760e38d93824d92ae8a82767eb85486b214346e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 29 Dec 2020 10:00:34 +0530 Subject: [PATCH] Callback to create tempdir in cache --- kitty/boss.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kitty/boss.py b/kitty/boss.py index 4119575ed..77846e86b 100644 --- a/kitty/boss.py +++ b/kitty/boss.py @@ -25,7 +25,8 @@ from .config import ( ) from .config_data import MINIMUM_FONT_SIZE from .constants import ( - appname, config_dir, is_macos, kitty_exe, supports_primary_selection + appname, cache_dir, config_dir, is_macos, kitty_exe, + supports_primary_selection ) from .fast_data_types import ( CLOSE_BEING_CONFIRMED, IMPERATIVE_CLOSE_REQUESTED, NO_CLOSE_REQUESTED, @@ -1379,6 +1380,10 @@ class Boss: with suppress(FileNotFoundError): os.remove(path) + def create_temp_dir_in_cache(self, prefix: Optional[str] = None, suffix: Optional[str] = None) -> str: + from tempfile import mkdtemp + return mkdtemp(prefix=prefix, suffix=suffix, dir=cache_dir()) + def set_update_check_process(self, process: Optional[PopenType] = None) -> None: if self.update_check_process is not None: with suppress(Exception):