diff --git a/openssl-sys/build.rs b/openssl-sys/build.rs index a5d3f2d1..a7b39e84 100644 --- a/openssl-sys/build.rs +++ b/openssl-sys/build.rs @@ -1,11 +1,11 @@ -#![feature(core, collections, os)] +#![feature(core, collections, env)] extern crate "pkg-config" as pkg_config; -use std::os; +use std::env; fn main() { - let target = os::getenv("TARGET").unwrap(); + let target = env::var_string("TARGET").unwrap(); let is_android = target.find_str("android").is_some(); // Without hackory, pkg-config will only look for host libraries. @@ -32,9 +32,10 @@ fn main() { } if is_android { - let path = os::getenv("OPENSSL_PATH").expect("Android does not provide openssl libraries, please \ - build them yourselves (instructions in the README) \ - and provide their location through $OPENSSL_PATH."); + let path = env::var_string("OPENSSL_PATH").ok() + .expect("Android does not provide openssl libraries, please build them yourselves \ + (instructions in the README) and provide their location through \ + $OPENSSL_PATH."); flags.push_str(format!(" -L {}", path).as_slice()); } diff --git a/openssl-sys/src/lib.rs b/openssl-sys/src/lib.rs index 84bd004b..fd16792b 100644 --- a/openssl-sys/src/lib.rs +++ b/openssl-sys/src/lib.rs @@ -1,6 +1,6 @@ #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] #![allow(dead_code)] -#![feature(core, io, libc, os, path, std_misc)] +#![feature(core, io, libc, path, std_misc, env)] extern crate libc; diff --git a/openssl-sys/src/probe.rs b/openssl-sys/src/probe.rs index 1615f73a..7896b3e9 100644 --- a/openssl-sys/src/probe.rs +++ b/openssl-sys/src/probe.rs @@ -1,4 +1,4 @@ -use std::os; +use std::env; use std::old_io::fs::PathExtensions; pub struct ProbeResult { @@ -41,17 +41,17 @@ pub fn init_ssl_cert_env_vars() { fn put(var: &str, path: Path) { // Don't stomp over what anyone else has set - match os::getenv(var) { + match env::var(var) { Some(..) => {} - None => os::setenv(var, path), + None => env::set_var(var, &path), } } } pub fn probe() -> ProbeResult { let mut result = ProbeResult { - cert_file: os::getenv("SSL_CERT_FILE").map(Path::new), - cert_dir: os::getenv("SSL_CERT_DIR").map(Path::new), + cert_file: env::var_string("SSL_CERT_FILE").ok().map(Path::new), + cert_dir: env::var_string("SSL_CERT_DIR").ok().map(Path::new), }; for certs_dir in find_certs_dirs().iter() { // cert.pem looks to be an openssl 1.0.1 thing, while