drying ethcore

This commit is contained in:
NikVolf
2016-08-01 19:39:53 +02:00
parent 86db5c08fc
commit d8a3137ce8
5 changed files with 25 additions and 45 deletions

View File

@@ -132,3 +132,21 @@ pub fn derive_ipc(src_path: &str) -> Result<(), Error> {
Ok(())
}
pub fn derive_binary(src_path: &str) -> Result<(), Error> {
use std::env;
use std::path::{Path, PathBuf};
let out_dir = env::var_os("OUT_DIR").unwrap();
let file_name = try!(PathBuf::from(src_path).file_name().ok_or(Error::InvalidFileName).map(|val| val.to_str().unwrap().to_owned()));
let final_path = Path::new(&out_dir).join(&file_name);
let mut registry = syntex::Registry::new();
register(&mut registry);
if let Err(_) = registry.expand("", &Path::new(src_path), &final_path) {
// will be reported by compiler
return Err(Error::ExpandFailure)
}
Ok(())
}