extern crate libc;
pub enum DesktopEnv {
Gnome,
Windows,
Unknown,
}
impl ::std::fmt::Display for DesktopEnv {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
use self::DesktopEnv::*;
write!(f, "{}", match *self {
Gnome => "gnome",
Windows => "windows",
Unknown => "unknown",
})
}
}
#[cfg(not(target_os = "windows"))] mod linux;
#[cfg(not(target_os = "windows"))] use self::linux as native;
#[cfg(target_os = "windows")] mod windows;
#[cfg(target_os = "windows")] use self::windows as native;
pub fn username() -> String {
native::username()
}
pub fn realname() -> String {
native::realname()
}
pub fn computer() -> String {
native::computer()
}
pub fn hostname() -> String {
native::hostname()
}
pub fn os() -> String {
native::os()
}
#[inline(always)]
pub fn env() -> DesktopEnv {
native::env()
}