From de43a4e5b78d2d2cdade8957a63fe30505cbbde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christopher=20L=C3=BCbbemeier?= Date: Wed, 21 Mar 2018 18:01:17 +0100 Subject: [PATCH] Fix inconsistent ordering in the file tree --- src/file_browser.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/file_browser.rs b/src/file_browser.rs index 9865296..ad59d81 100644 --- a/src/file_browser.rs +++ b/src/file_browser.rs @@ -337,8 +337,11 @@ impl FileBrowserWidget { fn cmp_dirs_first(lhs: &DirEntry, rhs: &DirEntry) -> io::Result { let lhs_metadata = fs::metadata(lhs.path())?; let rhs_metadata = fs::metadata(rhs.path())?; - if lhs_metadata.file_type() == rhs_metadata.file_type() { - Ok(lhs.path().cmp(&rhs.path())) + if lhs_metadata.is_dir() == rhs_metadata.is_dir() { + Ok(lhs.path() + .to_string_lossy() + .to_lowercase() + .cmp(&rhs.path().to_string_lossy().to_lowercase())) } else { if lhs_metadata.is_dir() { Ok(Ordering::Less)