1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 20:17:45 +00:00

Fix Windows lints/build errors

This commit is contained in:
electricboogie 2022-01-16 11:07:22 -06:00
parent e1bffea595
commit e6ce049d2c

View file

@ -1573,7 +1573,10 @@ fn enter_directory(
// metadata returned from a DirEntry matches GNU metadata for // metadata returned from a DirEntry matches GNU metadata for
// non-dereferenced files, and is *different* from the // non-dereferenced files, and is *different* from the
// metadata call on the path, see, for example, bad fds, // metadata call on the path, see, for example, bad fds,
// so we use here when we will need metadata later anyway // so we use dir_entry metadata here when we know we
// will need metadata later anyway
#[cfg(unix)]
{
if !res.must_dereference if !res.must_dereference
&& ((config.format == Format::Long) && ((config.format == Format::Long)
|| (config.sort == Sort::Name) || (config.sort == Sort::Name)
@ -1584,6 +1587,19 @@ fn enter_directory(
res.set_md(md) res.set_md(md)
} }
} }
}
#[cfg(not(unix))]
{
if !res.must_dereference
&& ((config.format == Format::Long)
|| (config.sort == Sort::Name)
|| (config.sort == Sort::None))
{
if let Ok(md) = dir_entry.metadata() {
res.set_md(md)
}
}
}
res res
} }
Err(_) => PathData::new(dir_entry.path(), None, None, config, false), Err(_) => PathData::new(dir_entry.path(), None, None, config, false),
@ -2045,11 +2061,8 @@ fn display_item_long(
} }
} }
let _ = write!( #[cfg(unix)]
out, let leading_char = {
"{}{} {}",
format_args!(
"{}?????????",
if item.ft.get().is_some() && item.ft.get().unwrap().is_some() { if item.ft.get().is_some() && item.ft.get().unwrap().is_some() {
if item.ft.get().unwrap().unwrap().is_char_device() { if item.ft.get().unwrap().unwrap().is_char_device() {
"c" "c"
@ -2064,7 +2077,29 @@ fn display_item_long(
} }
} else { } else {
"-" "-"
}, }
};
#[cfg(not(unix))]
let leading_char = {
if item.ft.get().is_some() && item.ft.get().unwrap().is_some() {
if item.ft.get().unwrap().unwrap().is_symlink() {
"l"
} else if item.ft.get().unwrap().unwrap().is_dir() {
"d"
} else {
"-"
}
} else {
"-"
}
};
let _ = write!(
out,
"{}{} {}",
format_args!(
"{}?????????", leading_char
), ),
if item.security_context.len() > 1 { if item.security_context.len() > 1 {
// GNU `ls` uses a "." character to indicate a file with a security context, // GNU `ls` uses a "." character to indicate a file with a security context,