summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authormario <mario-krehl@gmx.de>2016-07-04 16:23:45 +0200
committermario <mario-krehl@gmx.de>2016-07-04 17:41:38 +0200
commit04fff6070db16feb3432e3d5e6e30c1dbb914c6f (patch)
tree1d4b11c953fa01be1c17778acfd3c309fba40ce9 /bin
parent323c545db9ad605648805ac560b9ff43d9c1ec34 (diff)
changed from path().starts_with(PATH/imag-) to path.filename().starts_with(imag-) for simplicity. Also filtered out the command name for displaying
Diffstat (limited to 'bin')
-rw-r--r--bin/src/main.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/bin/src/main.rs b/bin/src/main.rs
index 3b154a47..32723dc3 100644
--- a/bin/src/main.rs
+++ b/bin/src/main.rs
@@ -68,17 +68,18 @@ fn get_commands() -> Vec<String> {
.into_iter()
.filter(|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,
}
})
.filter_map(|x| x.ok())
- .map(|path| {
- path.path()
- .to_str()
- .map(String::from)
+ .filter_map(|path| {
+ path.file_name()
+ .to_str()
+ .map(String::from)
})
- .filter_map(|x| x)
.collect()
})
})