getpwuid is linux platform only currently.

This commit is contained in:
Steve Smith
2016-06-05 11:07:28 +01:00
parent 8161bb7fe1
commit 1606770a3e
+6 -4
View File
@@ -164,7 +164,9 @@ fn cstr2string(cstr: *const c_char) -> String {
unsafe { String::from_utf8_lossy(CStr::from_ptr(cstr).to_bytes()).to_string() }
}
#[cfg(target_family = "unix")]
// Currently getpwuid is `linux` target only. If it's broken out into
// a posix-compliant attribute this can be updated...
#[cfg(target_family = "linux")]
fn display_uname(metadata: &Metadata) -> String {
use std::os::unix::fs::MetadataExt;
@@ -176,7 +178,7 @@ fn display_uname(metadata: &Metadata) -> String {
}
}
#[cfg(target_family = "unix")]
#[cfg(target_family = "linux")]
fn display_group(metadata: &Metadata) -> String {
use std::os::unix::fs::MetadataExt;
@@ -188,13 +190,13 @@ fn display_group(metadata: &Metadata) -> String {
}
}
#[cfg(target_family = "windows")]
#[cfg(not(target_family = "linux"))]
#[allow(unused_variables)]
fn display_uname(metadata: &Metadata) -> String {
"somebody".to_string()
}
#[cfg(target_family = "windows")]
#[cfg(not(target_family = "linux"))]
#[allow(unused_variables)]
fn display_group(metadata: &Metadata) -> String {
"somegroup".to_string()