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