Fix GlobStoreIdIterator implementation for new StoreId interface

This commit is contained in:
Matthias Beyer 2016-08-25 17:10:16 +02:00
parent 151877d95d
commit a110ecc2ec

View file

@ -1510,6 +1510,11 @@ mod glob_store_iter {
use storeid::StoreId; use storeid::StoreId;
use storeid::StoreIdIterator; use storeid::StoreIdIterator;
use error::StoreErrorKind as SEK;
use error::MapErrInto;
use libimagerror::trace::trace_error;
pub struct GlobStoreIdIterator { pub struct GlobStoreIdIterator {
store_path: PathBuf, store_path: PathBuf,
paths: Paths, paths: Paths,
@ -1549,19 +1554,12 @@ mod glob_store_iter {
self.paths self.paths
.next() .next()
.and_then(|o| { .and_then(|o| {
match o { o.map_err_into(SEK::StoreIdHandlingError)
Ok(o) => Some(o), .and_then(|p| StoreId::new(Some(self.store_path.clone()), p))
Err(e) => { .map_err(|e| {
debug!("GlobStoreIdIterator error: {:?}", e); debug!("GlobStoreIdIterator error: {:?}", e);
None trace_error(&e);
}, }).ok()
}
}).and_then(|p| {
p.strip_prefix(&self.store_path)
.ok()
.map(|p| {
StoreId::new(Some(self.store_path.clone()), PathBuf::from(p))
})
}) })
} }