Spaces:
Sleeping
Sleeping
| # 统一路径验证机制 | |
| from pathlib import Path | |
| from config_loader import get_paths | |
| def validate_paths(): | |
| paths = get_paths() | |
| required_dirs = [ | |
| paths['base_dir'], | |
| paths['data_dir'], | |
| paths['logging_dir'] | |
| ] | |
| for dir_path in required_dirs: | |
| if not dir_path.exists(): | |
| dir_path.mkdir(parents=True, exist_ok=True) | |
| if not dir_path.is_dir(): | |
| raise NotADirectoryError(f"路径配置错误: {dir_path}") | |