Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kenchou committed Dec 5, 2023
1 parent f22bbe3 commit 6c2ab6f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,16 +370,16 @@ fn main() -> std::io::Result<()> {
let mut operation_list: Vec<(PathBuf, String, Operation)> = vec![]; // Path, Pattern, Operation
for entry in WalkDir::new(&app_options.target_path)
.contents_first(true)
.into_iter()
.filter_entry(|e| is_not_hidden(e))
.filter_map(|e| e.ok())
.sorted_by(|a, b| {
.sort_by(|a, b| {
let is_dir_a = !a.file_type().is_dir() as i8;
let is_dir_b = !b.file_type().is_dir() as i8;
is_dir_a
.cmp(&is_dir_b)
.then(a.file_name().cmp(&b.file_name()))
})
.into_iter()
.filter_entry(|e| is_not_hidden(e))
.filter_map(|e| e.ok())
{
let filepath = entry.path();
let filename = entry.file_name().to_str().unwrap();
Expand Down

0 comments on commit 6c2ab6f

Please sign in to comment.