Flag uname/group functions as unix-specific and add NO-OP Windows versions.

This commit is contained in:
Steve Smith 2016-06-04 15:30:39 +01:00
parent ce7f23bcc4
commit 8161bb7fe1

View file

@ -164,6 +164,7 @@ fn cstr2string(cstr: *const c_char) -> String {
unsafe { String::from_utf8_lossy(CStr::from_ptr(cstr).to_bytes()).to_string() }
}
#[cfg(target_family = "unix")]
fn display_uname(metadata: &Metadata) -> String {
use std::os::unix::fs::MetadataExt;
@ -175,6 +176,7 @@ fn display_uname(metadata: &Metadata) -> String {
}
}
#[cfg(target_family = "unix")]
fn display_group(metadata: &Metadata) -> String {
use std::os::unix::fs::MetadataExt;
@ -186,6 +188,18 @@ fn display_group(metadata: &Metadata) -> String {
}
}
#[cfg(target_family = "windows")]
#[allow(unused_variables)]
fn display_uname(metadata: &Metadata) -> String {
"somebody".to_string()
}
#[cfg(target_family = "windows")]
#[allow(unused_variables)]
fn display_group(metadata: &Metadata) -> String {
"somegroup".to_string()
}
fn display_file_size(metadata: &Metadata, options: &getopts::Matches) -> String {
if options.opt_present("human-readable") {
convert(metadata.len() as f64)