mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-30 20:47:46 +00:00
ls/color_name: use PathData instead of a Path as we want to check for DirEntry
This commit is contained in:
parent
c0c5ec25b6
commit
1bd8ce5ddf
1 changed files with 5 additions and 5 deletions
|
@ -3070,11 +3070,11 @@ fn display_item_name(
|
||||||
if let Some(ls_colors) = &config.color {
|
if let Some(ls_colors) = &config.color {
|
||||||
let md = path.get_metadata(out);
|
let md = path.get_metadata(out);
|
||||||
name = if md.is_some() {
|
name = if md.is_some() {
|
||||||
color_name(name, &path.p_buf, md, ls_colors, style_manager)
|
color_name(name, path, md, ls_colors, style_manager)
|
||||||
} else {
|
} else {
|
||||||
color_name(
|
color_name(
|
||||||
name,
|
name,
|
||||||
&path.p_buf,
|
path,
|
||||||
path.p_buf.symlink_metadata().ok().as_ref(),
|
path.p_buf.symlink_metadata().ok().as_ref(),
|
||||||
ls_colors,
|
ls_colors,
|
||||||
style_manager,
|
style_manager,
|
||||||
|
@ -3163,7 +3163,7 @@ fn display_item_name(
|
||||||
|
|
||||||
name.push_str(&color_name(
|
name.push_str(&color_name(
|
||||||
escape_name(target.as_os_str(), &config.quoting_style),
|
escape_name(target.as_os_str(), &config.quoting_style),
|
||||||
&target_data.p_buf,
|
&target_data,
|
||||||
Some(&target_metadata),
|
Some(&target_metadata),
|
||||||
ls_colors,
|
ls_colors,
|
||||||
style_manager,
|
style_manager,
|
||||||
|
@ -3266,12 +3266,12 @@ impl StyleManager {
|
||||||
/// Colors the provided name based on the style determined for the given path.
|
/// Colors the provided name based on the style determined for the given path.
|
||||||
fn color_name(
|
fn color_name(
|
||||||
name: String,
|
name: String,
|
||||||
path: &Path,
|
path: &PathData,
|
||||||
md: Option<&Metadata>,
|
md: Option<&Metadata>,
|
||||||
ls_colors: &LsColors,
|
ls_colors: &LsColors,
|
||||||
style_manager: &mut StyleManager,
|
style_manager: &mut StyleManager,
|
||||||
) -> String {
|
) -> String {
|
||||||
match ls_colors.style_for_path_with_metadata(path, md) {
|
match ls_colors.style_for_path_with_metadata(&path.p_buf, md) {
|
||||||
Some(style) => style_manager.apply_style(style, &name),
|
Some(style) => style_manager.apply_style(style, &name),
|
||||||
None => name,
|
None => name,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue