瀏覽代碼

include symlinks to dirs when grouping dirs

When using the option --group-directories-first, symlinks to directories
are now first too.
Vicente Reyes 6 年之前
父節點
當前提交
69a7e53ee3
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      src/fs/filter.rs

+ 3 - 1
src/fs/filter.rs

@@ -129,7 +129,9 @@ impl FileFilter {
         if self.list_dirs_first {
             // This relies on the fact that `sort_by` is *stable*: it will keep
             // adjacent elements next to each other.
-            files.sort_by(|a, b| b.as_ref().is_directory().cmp(&a.as_ref().is_directory()));
+            files.sort_by(|a, b| {b.as_ref().points_to_directory()
+                .cmp(&a.as_ref().points_to_directory())
+            });
         }
     }
 }