Merge pull request #492 from mario-kr/fix_commands-not-shown

fix command finding in imag/bin/src/main.rs
This commit is contained in:
Matthias Beyer 2016-07-04 19:23:33 +02:00 committed by GitHub
commit 05d5b64db8
1 changed files with 7 additions and 6 deletions

View File

@ -68,17 +68,18 @@ fn get_commands() -> Vec<String> {
.into_iter() .into_iter()
.filter(|path| { .filter(|path| {
match path { match path {
&Ok(ref path) => path.path().starts_with(format!("{}/imag-", elem)), &Ok(ref p) => p.file_name()
.to_str()
.map_or(false, |filename| filename.starts_with("imag-")),
&Err(_) => false, &Err(_) => false,
} }
}) })
.filter_map(|x| x.ok()) .filter_map(|x| x.ok())
.map(|path| { .filter_map(|path| {
path.path() path.file_name()
.to_str() .to_str()
.map(String::from) .map(String::from)
}) })
.filter_map(|x| x)
.collect() .collect()
}) })
}) })