mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-14 14:12:31 +00:00
Manage symlink into the file ordering
This commit is contained in:
parent
1c852cab1c
commit
95306a0b05
2 changed files with 6 additions and 6 deletions
10
src/core.rs
10
src/core.rs
|
@ -1,5 +1,5 @@
|
|||
use formatter::*;
|
||||
use meta::Meta;
|
||||
use meta::{Meta, Type};
|
||||
use std::cmp::Ordering;
|
||||
use std::path::Path;
|
||||
use term_grid::{Cell, Direction, Filling, Grid, GridOptions};
|
||||
|
@ -190,11 +190,11 @@ impl<'a> Core<'a> {
|
|||
}
|
||||
|
||||
fn sort_by_meta(a: &Meta, b: &Meta) -> Ordering {
|
||||
if a.path.is_dir() == b.path.is_dir() {
|
||||
a.path.cmp(&b.path)
|
||||
} else if a.path.is_dir() && b.path.is_file() {
|
||||
if a.node_type == Type::Directory && b.node_type != Type::Directory {
|
||||
Ordering::Less
|
||||
} else {
|
||||
} else if b.node_type == Type::Directory && a.node_type != Type::Directory {
|
||||
Ordering::Greater
|
||||
} else {
|
||||
a.path.cmp(&b.path)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ pub enum MetaError {
|
|||
UnreadableMetadatas { path: String, err: io::Error },
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Type {
|
||||
SymLink(String),
|
||||
File,
|
||||
|
|
Loading…
Reference in a new issue