2011-07-30 21:11:14 -07:00
|
|
|
import std::option;
|
|
|
|
import std::generic_os::getenv;
|
2011-08-11 19:14:38 -07:00
|
|
|
import std::io;
|
2011-08-24 23:34:10 -07:00
|
|
|
import std::istr;
|
2011-07-30 21:11:14 -07:00
|
|
|
|
|
|
|
import common::config;
|
|
|
|
|
2011-08-30 15:40:25 -07:00
|
|
|
fn make_new_path(path: &istr) -> istr {
|
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
|
2011-08-30 15:40:25 -07:00
|
|
|
alt getenv(lib_path_env_var()) {
|
|
|
|
option::some(curr) {
|
|
|
|
istr::from_estr(#fmt["%s:%s",
|
|
|
|
istr::to_estr(path), istr::to_estr(curr)]) }
|
2011-07-30 21:11:14 -07:00
|
|
|
option::none. { path }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
2011-08-30 15:40:25 -07:00
|
|
|
fn lib_path_env_var() -> istr { ~"LD_LIBRARY_PATH" }
|
2011-07-30 21:11:14 -07:00
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
2011-08-30 15:40:25 -07:00
|
|
|
fn lib_path_env_var() -> istr { ~"DYLD_LIBRARY_PATH" }
|
2011-07-30 21:11:14 -07:00
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
2011-08-30 15:40:25 -07:00
|
|
|
fn lib_path_env_var() -> istr { "PATH" }
|
2011-07-30 21:11:14 -07:00
|
|
|
|
2011-08-30 15:40:25 -07:00
|
|
|
fn logv(config: &config, s: &istr) {
|
2011-07-30 21:11:14 -07:00
|
|
|
log s;
|
2011-08-24 21:26:19 -07:00
|
|
|
if config.verbose {
|
2011-08-30 15:40:25 -07:00
|
|
|
io::stdout().write_line(s);
|
2011-08-24 21:26:19 -07:00
|
|
|
}
|
2011-07-30 21:11:14 -07:00
|
|
|
}
|