+ if !input.exists() {
+ return Err(format!(
+ "The path '{}' does not exist.",
+ input.to_string_lossy()
+ ));
+ }
+ if !input.is_file() {
+ return Err(format!(
+ "The path '{}' is not a regular file.",
+ input.to_string_lossy()
+ ));
+ }
+ match File::open(input) {
+ Ok(f) => Ok(Box::new(f)),
+ Err(e) => Err(format!("File open: {}", e)),
+ }