Fix inconsistent ordering in the file tree
This commit is contained in:
parent
4be2d06032
commit
de43a4e5b7
@ -337,8 +337,11 @@ impl FileBrowserWidget {
|
|||||||
fn cmp_dirs_first(lhs: &DirEntry, rhs: &DirEntry) -> io::Result<Ordering> {
|
fn cmp_dirs_first(lhs: &DirEntry, rhs: &DirEntry) -> io::Result<Ordering> {
|
||||||
let lhs_metadata = fs::metadata(lhs.path())?;
|
let lhs_metadata = fs::metadata(lhs.path())?;
|
||||||
let rhs_metadata = fs::metadata(rhs.path())?;
|
let rhs_metadata = fs::metadata(rhs.path())?;
|
||||||
if lhs_metadata.file_type() == rhs_metadata.file_type() {
|
if lhs_metadata.is_dir() == rhs_metadata.is_dir() {
|
||||||
Ok(lhs.path().cmp(&rhs.path()))
|
Ok(lhs.path()
|
||||||
|
.to_string_lossy()
|
||||||
|
.to_lowercase()
|
||||||
|
.cmp(&rhs.path().to_string_lossy().to_lowercase()))
|
||||||
} else {
|
} else {
|
||||||
if lhs_metadata.is_dir() {
|
if lhs_metadata.is_dir() {
|
||||||
Ok(Ordering::Less)
|
Ok(Ordering::Less)
|
||||||
|
Loading…
Reference in New Issue
Block a user