mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Use env::var_os to read paths from the environment
This avoids unnecessary UTF-8 validation on OsStrings that we just pass back to the OS.
This commit is contained in:
parent
fe16c1d5c3
commit
c169f52b25
7 changed files with 19 additions and 18 deletions
|
@ -46,13 +46,13 @@ fn main() {
|
|||
|
||||
println!("Binding generation completed in {}s", start.elapsed().as_secs());
|
||||
|
||||
let json = PathBuf::from(env::var("OUT_DIR").unwrap()).join("build").join("InterfaceObjectMapData.json");
|
||||
let json = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("build").join("InterfaceObjectMapData.json");
|
||||
let json: Value = serde_json::from_reader(File::open(&json).unwrap()).unwrap();
|
||||
let mut map = phf_codegen::Map::new();
|
||||
for (key, value) in json.as_object().unwrap() {
|
||||
map.entry(Bytes(key), value.as_str().unwrap());
|
||||
}
|
||||
let phf = PathBuf::from(env::var("OUT_DIR").unwrap()).join("InterfaceObjectMapPhf.rs");
|
||||
let phf = PathBuf::from(env::var_os("OUT_DIR").unwrap()).join("InterfaceObjectMapPhf.rs");
|
||||
let mut phf = File::create(&phf).unwrap();
|
||||
write!(&mut phf, "pub static MAP: phf::Map<&'static [u8], unsafe fn(*mut JSContext, HandleObject)> = ").unwrap();
|
||||
map.build(&mut phf).unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue