浏览代码

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
Patrick Sean Klein 1 年之前
父节点
当前提交
172590380a

+ 1 - 1
src/output/file_name.rs

@@ -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);
             }

+ 0 - 0
tests/cmd/absolute_file_all.stderr


+ 1 - 0
tests/cmd/absolute_file_all.stdout

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

+ 2 - 0
tests/cmd/absolute_file_all.toml

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