工具
This commit is contained in:
10
common/utils.py
Normal file
10
common/utils.py
Normal file
@@ -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)
|
||||||
Reference in New Issue
Block a user