Validate output directory path. Args: path: Directory path to validate Returns: Validated Path object Raises: ConfigurationError: If path is invalid
(path: str)
| 99 | |
| 100 | |
| 101 | def validate_output_directory(path: str) -> Path: |
| 102 | """ |
| 103 | Validate output directory path. |
| 104 | |
| 105 | Args: |
| 106 | path: Directory path to validate |
| 107 | |
| 108 | Returns: |
| 109 | Validated Path object |
| 110 | |
| 111 | Raises: |
| 112 | ConfigurationError: If path is invalid |
| 113 | """ |
| 114 | if not path or not path.strip(): |
| 115 | raise ConfigurationError("Output directory cannot be empty") |
| 116 | |
| 117 | try: |
| 118 | resolved_path = Path(path).expanduser().resolve() |
| 119 | |
| 120 | # Check if path is writable (or parent is writable if path doesn't exist) |
| 121 | if resolved_path.exists(): |
| 122 | if not resolved_path.is_dir(): |
| 123 | raise ConfigurationError( |
| 124 | f"Output path exists but is not a directory: {path}" |
| 125 | ) |
| 126 | |
| 127 | return resolved_path |
| 128 | except Exception as e: |
| 129 | raise ConfigurationError(f"Invalid output directory path: {path}\nError: {e}") |
| 130 | |
| 131 | |
| 132 | def validate_repository_path(path: Path) -> Path: |
nothing calls this directly
no test coverage detected