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-09-01 19:27:58 -05:00
|
|
|
import std::str;
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
import common::config;
|
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn make_new_path(path: str) -> str {
|
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()) {
|
2011-09-02 17:34:58 -05:00
|
|
|
option::some(curr) { #fmt["%s:%s", path, curr] }
|
2011-07-30 23:11:14 -05:00
|
|
|
option::none. { path }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(target_os = "linux")]
|
2011-09-02 17:34:58 -05:00
|
|
|
fn lib_path_env_var() -> str { "LD_LIBRARY_PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
#[cfg(target_os = "macos")]
|
2011-09-02 17:34:58 -05:00
|
|
|
fn lib_path_env_var() -> str { "DYLD_LIBRARY_PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
2011-09-02 17:34:58 -05:00
|
|
|
fn lib_path_env_var() -> str { "PATH" }
|
2011-07-30 23:11:14 -05:00
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn logv(config: config, s: str) {
|
2011-07-30 23:11:14 -05:00
|
|
|
log s;
|
2011-09-02 17:34:58 -05:00
|
|
|
if config.verbose { io::stdout().write_line(s); }
|
2011-07-30 23:11:14 -05:00
|
|
|
}
|