11 lines
245 B
Python
11 lines
245 B
Python
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)
|