mirror of
https://github.com/TECHNOFAB11/pay-respects.git
synced 2025-12-12 22:40:09 +01:00
fix: some error handlings
This commit is contained in:
parent
1444eeab84
commit
15c1ba3370
7 changed files with 49 additions and 37 deletions
13
src/files.rs
13
src/files.rs
|
|
@ -38,13 +38,16 @@ pub fn get_best_match_file(input: &str) -> Option<String> {
|
|||
};
|
||||
|
||||
while let Some(exit_dir) = exit_dirs.pop() {
|
||||
let dir_files = files.filter_map(|file| {
|
||||
let file = file.unwrap();
|
||||
let file_name = file.file_name().into_string().unwrap();
|
||||
Some(file_name)
|
||||
}).collect::<Vec<String>>();
|
||||
let dir_files = files
|
||||
.map(|file| {
|
||||
let file = file.unwrap();
|
||||
|
||||
file.file_name().into_string().unwrap()
|
||||
})
|
||||
.collect::<Vec<String>>();
|
||||
|
||||
let best_match = find_similar(&exit_dir, dir_files);
|
||||
best_match.as_ref()?;
|
||||
|
||||
input = format!("{}/{}", input, best_match.unwrap());
|
||||
files = match std::fs::read_dir(&input) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue