Refactor: Outsource filepath building

This commit is contained in:
Matthias Beyer 2015-11-24 10:30:52 +01:00
parent f498ffa54c
commit 14ae6d623b

View file

@ -67,7 +67,7 @@ impl StorageBackend {
{ {
let written = p.write(f.contents()); let written = p.write(f.contents());
if let Ok(string) = written { if let Ok(string) = written {
let path = self.basepath + &f.id()[..]; let path = self.build_filepath(&f);
debug!("Writing file: {}", path); debug!("Writing file: {}", path);
Ok(Ok(())) Ok(Ok(()))
} else { } else {
@ -92,6 +92,10 @@ impl StorageBackend {
pub fn get_file_by_id(id: FileID) -> Option<File> { pub fn get_file_by_id(id: FileID) -> Option<File> {
} }
fn build_filepath(&self, f: &File) -> String {
self.basepath + &f.id()[..]
}
} }
#[derive(Debug)] #[derive(Debug)]