(script_path: P)
| 8 | use std::path::Path; |
| 9 | |
| 10 | pub fn hash_script<P: AsRef<Path>>(script_path: P) -> Result<(String, String)> { |
| 11 | let mut f = File::open(&script_path).chain_err(|| "Unable to open script file")?; |
| 12 | let mut buffer = Vec::new(); |
| 13 | f.read_to_end(&mut buffer).chain_err(|| "Unable to read script")?; |
| 14 | Ok((hash_path(script_path)?, hash(&buffer))) |
| 15 | } |
| 16 | |
| 17 | fn hash_path<P: AsRef<Path>>(p: P) -> Result<String> { |
| 18 | // let current_dir = ::std::env::current_dir().error_chain(|| "Unable to get current directory")?; |