Spaces:
Runtime error
Runtime error
| """ | |
| Path handling utilities | |
| """ | |
| from pathlib import Path | |
| from typing import Optional | |
| def ensure_dir(path: Path) -> Path: | |
| """Ensure directory exists""" | |
| path.mkdir(parents=True, exist_ok=True) | |
| return path | |
| def get_latest_output(output_dir: Path, pattern: str = "*.glb") -> Optional[Path]: | |
| """Get latest output file""" | |
| files = list(output_dir.glob(pattern)) | |
| if not files: | |
| return None | |
| return max(files, key=lambda p: p.stat().st_mtime) | |
| def validate_file_exists(path: Path, description: str = "File") -> Path: | |
| """Validate file exists""" | |
| if not path.exists(): | |
| raise FileNotFoundError(f"{description} not found: {path}") | |
| return path | |