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:
Matt Brubeck 2017-10-20 09:03:21 -07:00
parent fe16c1d5c3
commit c169f52b25
7 changed files with 19 additions and 18 deletions

View file

@ -17,7 +17,7 @@ fn main() {
fn android_main() {
// Get the NDK path from NDK_HOME env.
let ndk_path = env::var("ANDROID_NDK").ok().expect("Please set the ANDROID_NDK environment variable");
let ndk_path = env::var_os("ANDROID_NDK").expect("Please set the ANDROID_NDK environment variable");
let ndk_path = Path::new(&ndk_path);
// Build up the path to the NDK compilers
@ -62,7 +62,7 @@ fn android_main() {
println!("toolchain path is: {}", toolchain_path.to_str().unwrap());
// Get the output directory.
let out_dir = env::var("OUT_DIR").ok().expect("Cargo should have set the OUT_DIR environment variable");
let out_dir = env::var("OUT_DIR").expect("Cargo should have set the OUT_DIR environment variable");
let directory = Path::new(&out_dir);
// compiling android_native_app_glue.c