Fix libimagentryview::builtin::versions::* for new StoreId interface
This commit is contained in:
parent
7ac98e1e54
commit
c9612437fd
1 changed files with 16 additions and 14 deletions
|
@ -5,6 +5,7 @@ use libimagerror::into::IntoError;
|
||||||
use viewer::Viewer;
|
use viewer::Viewer;
|
||||||
use result::Result;
|
use result::Result;
|
||||||
use error::ViewErrorKind as VEK;
|
use error::ViewErrorKind as VEK;
|
||||||
|
use error::MapErrInto;
|
||||||
|
|
||||||
pub struct VersionsViewer<'a> {
|
pub struct VersionsViewer<'a> {
|
||||||
store: &'a Store,
|
store: &'a Store,
|
||||||
|
@ -27,27 +28,28 @@ impl<'a> Viewer for VersionsViewer<'a> {
|
||||||
|
|
||||||
entr.get_location()
|
entr.get_location()
|
||||||
.clone()
|
.clone()
|
||||||
.storified(self.store)
|
.with_base(self.store.path().clone())
|
||||||
.to_str()
|
.to_str()
|
||||||
.and_then(|s| s.split("~").next())
|
.map_err_into(VEK::ViewError)
|
||||||
.map(|component| {
|
.and_then(|s| {
|
||||||
glob(&format!("{}~*", component)[..])
|
s.split("~")
|
||||||
.map_err(|_| VEK::PatternError.into_error())
|
.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| {
|
.and_then(|paths| {
|
||||||
for entry in paths {
|
for entry in paths {
|
||||||
let p = match entry {
|
println!("{}",
|
||||||
Err(_) => return Err(VEK::GlobError.into_error()),
|
try!(entry
|
||||||
Ok(p) => p,
|
.map_err(|_| VEK::GlobError.into_error()))
|
||||||
};
|
.file_name()
|
||||||
let p = p.file_name()
|
|
||||||
.and_then(|s| s.to_str())
|
.and_then(|s| s.to_str())
|
||||||
.unwrap(); // TODO
|
.unwrap() // TODO
|
||||||
println!("{}", p);
|
);
|
||||||
};
|
};
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.unwrap_or(Err(VEK::PatternBuildingError.into_error()))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue