Files
RustPython/vm/src/util.rs
holygits 4453c3e561 Create error types for parser and compiler
Pass through locations and tokens in ParseError
2019-02-14 10:21:21 +13:00

14 lines
324 B
Rust

use std::fs::File;
use std::io::{Read, Result};
use std::path::Path;
/// Read a file at `path` into a String
pub fn read_file(path: &Path) -> Result<String> {
info!("Loading file {:?}", path);
let mut f = File::open(&path)?;
let mut buffer = String::new();
f.read_to_string(&mut buffer)?;
Ok(buffer)
}