fix: do not print parent filename with --absolute=on

The parent path of a file was added even with absolute={on,follow}, causing the parent path being prepended to the resolved (absolute) filepath.

Fixes: #1151
This commit is contained in:
Patrick Sean Klein 2024-10-06 15:24:13 +01:00 committed by Christina Sørensen
parent feda3299fd
commit 172590380a
4 changed files with 4 additions and 1 deletions

View file

@ -237,7 +237,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
bits.push(style.paint(" ".repeat(spaces_count as usize)));
}
if self.file.parent_dir.is_none() {
if self.file.parent_dir.is_none() && self.options.absolute == Absolute::Off {
if let Some(parent) = self.file.path.parent() {
self.add_parent_bits(&mut bits, parent);
}

View file

View file

@ -0,0 +1 @@
[CWD]/tests/itest/index.svg

View file

@ -0,0 +1,2 @@
bin.name = "eza"
args = "tests/itest/index.svg --absolute"