From 5593442534e2b82f863b47ea231f100151524a4c Mon Sep 17 00:00:00 2001 From: aszerW Date: Sat, 25 Oct 2025 13:24:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 common/utils.py diff --git a/common/utils.py b/common/utils.py new file mode 100644 index 0000000..94376fa --- /dev/null +++ b/common/utils.py @@ -0,0 +1,10 @@ +import os + + +def ensure_directory_exists(target_path: str, is_file: bool = False): + directory = target_path + if is_file: + directory = os.path.dirname(target_path) + + if not os.path.exists(directory): + os.makedirs(directory)