From a9e12d539b3ce45e96be520999b32958d4c7cc6c Mon Sep 17 00:00:00 2001 From: puke <1129090915@qq.com> Date: Fri, 21 Nov 2025 11:22:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E4=B8=B4=E6=97=B6=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=92=8C=E8=BE=93=E5=87=BA=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E5=9C=A8=E8=BF=94=E5=9B=9E=E8=B7=AF=E5=BE=84=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pixelle_video/utils/os_util.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pixelle_video/utils/os_util.py b/pixelle_video/utils/os_util.py index 12c26dc..bbec0ce 100644 --- a/pixelle_video/utils/os_util.py +++ b/pixelle_video/utils/os_util.py @@ -83,6 +83,8 @@ def get_temp_path(*paths: str) -> str: """ Get path relative to Pixelle-Video temp folder + Ensures temp directory exists before returning path. + Args: *paths: Path components to join @@ -94,6 +96,10 @@ def get_temp_path(*paths: str) -> str: # Returns: "/path/to/project/temp/audio.mp3" """ temp_path = get_root_path("temp") + + # Ensure temp directory exists + os.makedirs(temp_path, exist_ok=True) + if paths: return os.path.join(temp_path, *paths) return temp_path @@ -102,6 +108,8 @@ def get_temp_path(*paths: str) -> str: def get_data_path(*paths: str) -> str: """ Get path relative to Pixelle-Video data folder + + Ensures data directory exists before returning path. Args: *paths: Path components to join @@ -114,6 +122,10 @@ def get_data_path(*paths: str) -> str: # Returns: "/path/to/project/data/videos/output.mp4" """ data_path = get_root_path("data") + + # Ensure data directory exists + os.makedirs(data_path, exist_ok=True) + if paths: return os.path.join(data_path, *paths) return data_path @@ -122,6 +134,8 @@ def get_data_path(*paths: str) -> str: def get_output_path(*paths: str) -> str: """ Get path relative to Pixelle-Video output folder + + Ensures output directory exists before returning path. Args: *paths: Path components to join @@ -134,6 +148,10 @@ def get_output_path(*paths: str) -> str: # Returns: "/path/to/project/output/video.mp4" """ output_path = get_root_path("output") + + # Ensure output directory exists + os.makedirs(output_path, exist_ok=True) + if paths: return os.path.join(output_path, *paths) return output_path