Fixup: get_file_by_id() gets &Module as well, so it can use build_filepath_with_id()

This commit is contained in:
Matthias Beyer 2015-12-02 11:47:37 +01:00
parent c81800d985
commit d35e89f27c

View file

@ -172,11 +172,11 @@ impl StorageBackend {
* TODO: Needs refactoring, as there might be an error when reading from * TODO: Needs refactoring, as there might be an error when reading from
* disk OR the id just does not exist. * disk OR the id just does not exist.
*/ */
pub fn get_file_by_id<'a, HP>(&self, id: FileID, p: &Parser<HP>) -> Option<File> pub fn get_file_by_id<'a, HP>(&self, m: &'a Module, id: &FileID, p: &Parser<HP>) -> Option<File<'a>>
where HP: FileHeaderParser<'a> where HP: FileHeaderParser
{ {
debug!("Searching for file with id '{}'", id); debug!("Searching for file with id '{}'", id);
if let Ok(mut fs) = FSFile::open(self.build_filepath_with_id(id.clone())) { if let Ok(mut fs) = FSFile::open(self.build_filepath_with_id(m, id.clone())) {
let mut s = String::new(); let mut s = String::new();
fs.read_to_string(&mut s); fs.read_to_string(&mut s);
debug!("Success reading file with id '{}'", id); debug!("Success reading file with id '{}'", id);