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)