Backend: Use FileID::from()

This commit is contained in:
Matthias Beyer 2015-12-02 13:25:10 +01:00
parent d3bdb39468
commit 292e29a5f1

View file

@ -60,11 +60,7 @@ impl StorageBackend {
for entry in globlist { for entry in globlist {
if let Ok(path) = entry { if let Ok(path) = entry {
debug!(" - File: {:?}", path); debug!(" - File: {:?}", path);
if let Ok(id) = from_pathbuf(&path) { v.push(FileID::from(&path));
v.push(id);
} else {
error!("Cannot parse ID from path: {:?}", path);
}
} else { } else {
// Entry is not a path // Entry is not a path
} }
@ -80,8 +76,7 @@ impl StorageBackend {
{ {
glob(&self.prefix_of_files_for_module(m)[..]).and_then(|globlist| { glob(&self.prefix_of_files_for_module(m)[..]).and_then(|globlist| {
let v = globlist.filter_map(Result::ok) let v = globlist.filter_map(Result::ok)
.map(|pbuf| from_pathbuf(&pbuf)) .map(|pbuf| FileID::from(&pbuf))
.filter_map(Result::ok)
.collect::<Vec<FileID>>() .collect::<Vec<FileID>>()
.into_iter(); .into_iter();
Ok(v) Ok(v)
@ -233,7 +228,8 @@ impl StorageBackend {
debug!(" basepath: '{}'", self.basepath); debug!(" basepath: '{}'", self.basepath);
debug!(" storepath: '{}'", self.storepath); debug!(" storepath: '{}'", self.storepath);
debug!(" id : '{}'", id); debug!(" id : '{}'", id);
self.prefix_of_files_for_module(owner) + "-" + &id[..] + ".imag" let idstr : String = id.into();
self.prefix_of_files_for_module(owner) + "-" + &idstr[..] + ".imag"
} }
fn prefix_of_files_for_module(&self, m: &Module) -> String { fn prefix_of_files_for_module(&self, m: &Module) -> String {