about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2014-05-08 23:33:22 +1000
committerHuon Wilson <dbau.pp+github@gmail.com>2014-05-15 23:04:09 +1000
commit18c13de5e6dfd4631f9ed05e0ab49305bf0384ac (patch)
tree333a241d58716b35a8eb47c34a4eabb1e4ade7b2 /src/libstd
parentb1ee3200b52a87ba788a6edf3b14db9466f2cb7d (diff)
downloadrust-18c13de5e6dfd4631f9ed05e0ab49305bf0384ac.tar.gz
rust-18c13de5e6dfd4631f9ed05e0ab49305bf0384ac.zip
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.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/unstable/dynamic_lib.rs14
1 files 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::<Vec<_>>();
-        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());
     }