mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-15 06:22:47 +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 formatter::*;
|
||||||
use meta::Meta;
|
use meta::{Meta, Type};
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use term_grid::{Cell, Direction, Filling, Grid, GridOptions};
|
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 {
|
fn sort_by_meta(a: &Meta, b: &Meta) -> Ordering {
|
||||||
if a.path.is_dir() == b.path.is_dir() {
|
if a.node_type == Type::Directory && b.node_type != Type::Directory {
|
||||||
a.path.cmp(&b.path)
|
|
||||||
} else if a.path.is_dir() && b.path.is_file() {
|
|
||||||
Ordering::Less
|
Ordering::Less
|
||||||
} else {
|
} else if b.node_type == Type::Directory && a.node_type != Type::Directory {
|
||||||
Ordering::Greater
|
Ordering::Greater
|
||||||
|
} else {
|
||||||
|
a.path.cmp(&b.path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ pub enum MetaError {
|
||||||
UnreadableMetadatas { path: String, err: io::Error },
|
UnreadableMetadatas { path: String, err: io::Error },
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug, PartialEq)]
|
||||||
pub enum Type {
|
pub enum Type {
|
||||||
SymLink(String),
|
SymLink(String),
|
||||||
File,
|
File,
|
||||||
|
|
Loading…
Reference in a new issue