pub fn ensure_directory(path: &Path, dir_type: &str) -> Result<(), ProcessError>Expand description
Ensures the specified directory exists, creating it if necessary.
§Arguments
path- The path of the directory to check.dir_type- A label describing the directory type (e.g., “content”, “output”).
§Returns
Result<(), ProcessError>- ReturnsOkif the directory exists or is successfully created.
§Errors
- Returns
ProcessError::DirectoryCreationif the directory cannot be created due to permissions or other issues.
§Example
let path = Path::new("path/to/output");
ensure_directory(path, "output").expect("Failed to ensure directory exists");