1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
13 #[cfg(target_os = "win32")]
16 /// Conversion table from triple OS name to Rust SYSNAME
17 static OS_TABLE: &'static [(&'static str, &'static str)] = &[
21 ("android", "android"),
23 ("freebsd", "freebsd"),
26 pub fn get_os(triple: &str) -> &'static str {
27 for &(triple_os, os) in OS_TABLE.iter() {
28 if triple.contains(triple_os) {
32 fail!("Cannot determine OS from triple");
35 #[cfg(target_os = "win32")]
36 pub fn make_new_path(path: &str) -> String {
38 // Windows just uses PATH as the library search path, so we have to
39 // maintain the current value while adding our own
40 match getenv(lib_path_env_var().as_slice()) {
42 format_strbuf!("{}{}{}", path, path_div(), curr)
44 None => path.to_str().to_string()
48 #[cfg(target_os = "win32")]
49 pub fn lib_path_env_var() -> String { "PATH".to_string() }
51 #[cfg(target_os = "win32")]
52 pub fn path_div() -> String { ";".to_string() }
54 pub fn logv(config: &Config, s: String) {
56 if config.verbose { println!("{}", s); }