core: Add os::family. Returns either 'windows' or 'unix'

This commit is contained in:
Brian Anderson 2012-06-06 21:39:41 -07:00
parent cd02046de4
commit 2c5a660c99

View File

@ -28,7 +28,7 @@
export close, fclose, fsync_fd, waitpid;
export env, getenv, setenv, fdopen, pipe;
export getcwd, dll_filename, self_exe_path;
export exe_suffix, dll_suffix, sysname, arch;
export exe_suffix, dll_suffix, sysname, arch, family;
export homedir, list_dir, list_dir_path, path_is_dir, path_exists,
make_absolute, make_dir, remove_dir, change_dir, remove_file,
copy_file;
@ -755,6 +755,14 @@ fn set_exit_status(code: int) {
rustrt::rust_set_exit_status(code as libc::intptr_t);
}
#[cfg(target_os = "macos")]
#[cfg(target_os = "linux")]
#[cfg(target_os = "freebsd")]
fn family() -> str { "unix" }
#[cfg(target_os = "win32")]
fn family() -> str { "windows" }
#[cfg(target_os = "macos")]
mod consts {
fn sysname() -> str { "macos" }