2011-12-13 18:25:51 -06:00
|
|
|
import option;
|
2012-03-12 22:04:27 -05:00
|
|
|
import os::getenv;
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
import common::config;
|
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn make_new_path(path: ~str) -> ~str {
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
// Windows just uses PATH as the library search path, so we have to
|
|
|
|
// maintain the current value while adding our own
|
2012-08-06 14:34:08 -05:00
|
|
|
match getenv(lib_path_env_var()) {
|
2012-08-20 14:23:37 -05:00
|
|
|
option::Some(curr) => {
|
2012-08-22 19:24:52 -05:00
|
|
|
fmt!("%s%s%s", path, path_div(), curr)
|
2011-09-29 20:30:00 -05:00
|
|
|
}
|
2012-08-20 14:23:37 -05:00
|
|
|
option::None => path
|
2011-07-30 23:11:14 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
2011-12-30 02:18:55 -06:00
|
|
|
#[cfg(target_os = "freebsd")]
|
2012-07-14 00:57:48 -05:00
|
|
|
fn lib_path_env_var() -> ~str { ~"LD_LIBRARY_PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
2012-07-14 13:05:10 -05:00
|
|
|
fn lib_path_env_var() -> ~str { ~"DYLD_LIBRARY_PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
2012-07-14 13:05:10 -05:00
|
|
|
fn lib_path_env_var() -> ~str { ~"PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
2011-09-29 20:30:00 -05:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[cfg(target_os = "macos")]
|
2011-12-30 02:18:55 -06:00
|
|
|
#[cfg(target_os = "freebsd")]
|
2012-07-14 00:57:48 -05:00
|
|
|
fn path_div() -> ~str { ~":" }
|
2011-09-29 20:30:00 -05:00
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
2012-07-14 20:28:20 -05:00
|
|
|
fn path_div() -> ~str { ~";" }
|
2011-09-29 20:30:00 -05:00
|
|
|
|
2012-07-14 00:57:48 -05:00
|
|
|
fn logv(config: config, s: ~str) {
|
2011-12-22 19:53:53 -06:00
|
|
|
log(debug, s);
|
2012-01-11 08:15:54 -06:00
|
|
|
if config.verbose { io::println(s); }
|
2011-07-30 23:11:14 -05:00
|
|
|
}
|