Переглянути джерело

Handle linking to root directories better

We don't need a special case for this.
Kevin Ballard 8 роки тому
батько
коміт
4beb7b6cb1
1 змінених файлів з 1 додано та 8 видалено
  1. 1 8
      src/output/mod.rs

+ 1 - 8
src/output/mod.rs

@@ -47,11 +47,7 @@ pub fn filename(file: &File, colours: &Colours, links: bool, classify: bool) ->
                 bits.push(colours.punctuation.paint("->"));
                 bits.push(Style::default().paint(" "));
 
-                if target.path.as_os_str() == "/" {
-                    // Do nothing when linking to the root directory.
-                    // The entirety of the path is the file name!
-                }
-                else if let Some(parent) = target.path.parent() {
+                if let Some(parent) = target.path.parent() {
                     let coconut = parent.components().count();
 
                     if coconut == 1 && parent.has_root() {
@@ -62,9 +58,6 @@ pub fn filename(file: &File, colours: &Colours, links: bool, classify: bool) ->
                         bits.push(colours.symlink_path.paint("/"));
                     }
                 }
-                else {
-                    bits.push(colours.symlink_path.paint("/"));
-                }
 
                 if !target.name.is_empty() {
                     bits.push(file_colour(colours, &target).paint(target.name));