rust/src/compiletest/util.rs

39 lines
908 B
Rust
Raw Normal View History

use os::getenv;
use common::config;
fn make_new_path(path: ~str) -> ~str {
// 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)
}
2012-08-20 14:23:37 -05:00
option::None => path
}
}
#[cfg(target_os = "linux")]
2011-12-30 02:18:55 -06:00
#[cfg(target_os = "freebsd")]
fn lib_path_env_var() -> ~str { ~"LD_LIBRARY_PATH" }
#[cfg(target_os = "macos")]
fn lib_path_env_var() -> ~str { ~"DYLD_LIBRARY_PATH" }
#[cfg(target_os = "win32")]
fn lib_path_env_var() -> ~str { ~"PATH" }
#[cfg(target_os = "linux")]
#[cfg(target_os = "macos")]
2011-12-30 02:18:55 -06:00
#[cfg(target_os = "freebsd")]
fn path_div() -> ~str { ~":" }
#[cfg(target_os = "win32")]
2012-07-14 20:28:20 -05:00
fn path_div() -> ~str { ~";" }
fn logv(config: config, s: ~str) {
log(debug, s);
if config.verbose { io::println(s); }
}