File size: 688 Bytes
a03fc9e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
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