include symlinks to dirs when grouping dirs

When using the option --group-directories-first, symlinks to directories
are now first too.
This commit is contained in:
Vicente Reyes 2019-07-01 20:49:30 -04:00
parent 89c861f24d
commit 69a7e53ee3
No known key found for this signature in database
GPG Key ID: E594BA444CBE8742

View File

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