2011-12-13 18:25:51 -06:00
|
|
|
import option;
|
2011-07-30 23:11:14 -05:00
|
|
|
import std::generic_os::getenv;
|
2011-08-11 21:14:38 -05:00
|
|
|
import std::io;
|
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-29 20:30:00 -05:00
|
|
|
option::some(curr) {
|
|
|
|
#fmt["%s%s%s", path, path_div(), 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-29 20:30:00 -05:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
fn path_div() -> str { ":" }
|
|
|
|
|
|
|
|
#[cfg(target_os = "win32")]
|
|
|
|
fn path_div() -> str { ";" }
|
|
|
|
|
2011-09-12 04:27:30 -05:00
|
|
|
fn logv(config: config, s: str) {
|
2011-12-22 19:53:53 -06:00
|
|
|
log(debug, 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
|
|
|
}
|