From 18c13de5e6dfd4631f9ed05e0ab49305bf0384ac Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Thu, 8 May 2014 23:33:22 +1000 Subject: [PATCH] std:: switch the order in which dynamic_lib adds search paths. The compiler needs to be opening e.g. libregex in the correct directory, which requires getting these in the right order. --- src/libstd/unstable/dynamic_lib.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs index 87d531cc627..b2a912e65a8 100644 --- a/src/libstd/unstable/dynamic_lib.rs +++ b/src/libstd/unstable/dynamic_lib.rs @@ -16,8 +16,8 @@ A simple wrapper over the platform's dynamic library facilities */ + use c_str::ToCStr; -use iter::Iterator; use mem; use ops::*; use option::*; @@ -25,7 +25,7 @@ use os; use path::GenericPath; use path; use result::*; -use slice::{Vector,OwnedVector}; +use slice::Vector; use str; use vec::Vec; @@ -75,10 +75,12 @@ impl DynamicLibrary { } else { ("LD_LIBRARY_PATH", ':' as u8) }; - let newenv = os::getenv_as_bytes(envvar).unwrap_or(box []); - let mut newenv = newenv.move_iter().collect::>(); - newenv.push_all(&[sep]); - newenv.push_all(path.as_vec()); + let mut newenv = Vec::from_slice(path.as_vec()); + newenv.push(sep); + match os::getenv_as_bytes(envvar) { + Some(bytes) => newenv.push_all(bytes), + None => {} + } os::setenv(envvar, str::from_utf8(newenv.as_slice()).unwrap()); }