mirror of
https://github.com/shmilylty/OneForAll.git
synced 2026-08-26 12:57:50 +08:00
提前路径判断是否为None
This commit is contained in:
@@ -157,6 +157,8 @@ def check_path(path, table, format):
|
|||||||
:return: 目录路径
|
:return: 目录路径
|
||||||
"""
|
"""
|
||||||
default_path = config.result_save_path.joinpath(f'{table}.{format}')
|
default_path = config.result_save_path.joinpath(f'{table}.{format}')
|
||||||
|
if path is None:
|
||||||
|
path = default_path
|
||||||
try:
|
try:
|
||||||
path = Path(path)
|
path = Path(path)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -169,6 +171,7 @@ def check_path(path, table, format):
|
|||||||
if not parent_path.exists():
|
if not parent_path.exists():
|
||||||
logger.log('ALERT', f'不存在{parent_path}目录将会新建')
|
logger.log('ALERT', f'不存在{parent_path}目录将会新建')
|
||||||
parent_path.mkdir(parents=True, exist_ok=True)
|
parent_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
# 意外情况
|
||||||
if not path:
|
if not path:
|
||||||
path = default_path
|
path = default_path
|
||||||
if path.resolve() == default_path:
|
if path.resolve() == default_path:
|
||||||
|
|||||||
Reference in New Issue
Block a user