diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-08-25 19:48:02 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-08-28 18:41:56 +0200 |
commit | c9612437fd4ffecd460ee4bdcb8a9b77a1e94d76 (patch) | |
tree | 5f5f07f8c78c0950c4177744f58430e5f0a4e5c3 /libimagentryview | |
parent | 7ac98e1e5442986fa8644535c68ae4b3b8d3cab4 (diff) |
Fix libimagentryview::builtin::versions::* for new StoreId interface
Diffstat (limited to 'libimagentryview')
-rw-r--r-- | libimagentryview/src/builtin/versions.rs | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/libimagentryview/src/builtin/versions.rs b/libimagentryview/src/builtin/versions.rs index 11439c36..1b09b332 100644 --- a/libimagentryview/src/builtin/versions.rs +++ b/libimagentryview/src/builtin/versions.rs @@ -5,6 +5,7 @@ use libimagerror::into::IntoError; use viewer::Viewer; use result::Result; use error::ViewErrorKind as VEK; +use error::MapErrInto; pub struct VersionsViewer<'a> { store: &'a Store, @@ -27,27 +28,28 @@ impl<'a> Viewer for VersionsViewer<'a> { entr.get_location() .clone() - .storified(self.store) + .with_base(self.store.path().clone()) .to_str() - .and_then(|s| s.split("~").next()) - .map(|component| { - glob(&format!("{}~*", component)[..]) - .map_err(|_| VEK::PatternError.into_error()) + .map_err_into(VEK::ViewError) + .and_then(|s| { + s.split("~") + .next() + .ok_or(VEK::PatternError.into_error()) + .map(|s| format!("{}~*", s)) + .and_then(|pat| glob(&pat[..]).map_err(|_| VEK::PatternError.into_error())) .and_then(|paths| { for entry in paths { - let p = match entry { - Err(_) => return Err(VEK::GlobError.into_error()), - Ok(p) => p, - }; - let p = p.file_name() - .and_then(|s| s.to_str()) - .unwrap(); // TODO - println!("{}", p); + println!("{}", + try!(entry + .map_err(|_| VEK::GlobError.into_error())) + .file_name() + .and_then(|s| s.to_str()) + .unwrap() // TODO + ); }; Ok(()) }) }) - .unwrap_or(Err(VEK::PatternBuildingError.into_error())) } } |