This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
md-pdf-rs/src/input.rs
2017-07-26 15:33:13 +01:00

20 lines
629 B
Rust

use std::fs::File;
use std::io::Read;
use std::path::PathBuf;
use utils::result_override;
pub fn read_input_files(files: Vec<PathBuf>) -> Result<String, String> {
let mut input = String::new();
for input_file_path in files.iter() {
let mut input_file = try!(result_override(
File::open(input_file_path),
format!("Failed to open input file {}.", input_file_path.display())
));
try!(result_override(
input_file.read_to_string(&mut input),
format!("Failed to read input file {}.", input_file_path.display())
));
}
return Ok(input);
}