blob: 0b2c8d78f07ea2305b6ed2bfefb321dcd28aac63 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# This file is part of Senator Sperma
# Licensed under the GPL-3.0 License
# Copyright (C) 2026 Salmonik @ salmonik@tuta.io
# https://codeberg.org/salmonik/senator-sperma
import os
import tempfile
def get_temp_dir(subdir: str = "senator_sperma") -> str:
"""Get or create a temp subdirectory.
Uses system temp directory (/tmp on Linux, %TEMP% on Windows).
OS handles cleanup automatically.
"""
base_temp = tempfile.gettempdir()
temp_path = os.path.join(base_temp, subdir)
os.makedirs(temp_path, exist_ok=True)
return temp_path
|