rust/src/compiletest/util.rs

40 lines
929 B
Rust
Raw Normal View History

import option;
import os::getenv;
import 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-03 21:59:04 -05:00
option::some(curr) => {
fmt!{"%s%s%s", path, path_div(), curr}
}
2012-08-03 21:59:04 -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); }
}