2012-09-07 18:08:21 -07:00
|
|
|
use os::getenv;
|
2011-07-30 21:11:14 -07:00
|
|
|
|
2012-09-07 18:08:21 -07:00
|
|
|
use common::config;
|
2011-07-30 21:11:14 -07:00
|
|
|
|
2012-07-13 22:57:48 -07:00
|
|
|
fn make_new_path(path: ~str) -> ~str {
|
2011-07-30 21:11:14 -07: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 12:34:08 -07:00
|
|
|
match getenv(lib_path_env_var()) {
|
2012-08-20 12:23:37 -07:00
|
|
|
option::Some(curr) => {
|
2012-08-22 17:24:52 -07:00
|
|
|
fmt!("%s%s%s", path, path_div(), curr)
|
2011-09-29 18:30:00 -07:00
|
|
|
}
|
2012-08-20 12:23:37 -07:00
|
|
|
option::None => path
|
2011-07-30 21:11:14 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
2011-12-30 16:18:55 +08:00
|
|
|
#[cfg(target_os = "freebsd")]
|
2012-07-13 22:57:48 -07:00
|
|
|
fn lib_path_env_var() -> ~str { ~"LD_LIBRARY_PATH" }
|
2011-07-30 21:11:14 -07:00
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
2012-07-14 11:05:10 -07:00
|
|
|
fn lib_path_env_var() -> ~str { ~"DYLD_LIBRARY_PATH" }
|
2011-07-30 21:11:14 -07:00
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
2012-07-14 11:05:10 -07:00
|
|
|
fn lib_path_env_var() -> ~str { ~"PATH" }
|
2011-07-30 21:11:14 -07:00
|
|
|
|
2011-09-29 18:30:00 -07:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[cfg(target_os = "macos")]
|
2011-12-30 16:18:55 +08:00
|
|
|
#[cfg(target_os = "freebsd")]
|
2012-07-13 22:57:48 -07:00
|
|
|
fn path_div() -> ~str { ~":" }
|
2011-09-29 18:30:00 -07:00
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
2012-07-14 18:28:20 -07:00
|
|
|
fn path_div() -> ~str { ~";" }
|
2011-09-29 18:30:00 -07:00
|
|
|
|
2012-07-13 22:57:48 -07:00
|
|
|
fn logv(config: config, s: ~str) {
|
2011-12-22 17:53:53 -08:00
|
|
|
log(debug, s);
|
2012-01-11 15:15:54 +01:00
|
|
|
if config.verbose { io::println(s); }
|
2011-07-30 21:11:14 -07:00
|
|
|
}
|