Refactor: Outsource filepath building
This commit is contained in:
parent
f498ffa54c
commit
14ae6d623b
1 changed files with 5 additions and 1 deletions
|
@ -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)]
|
||||||
|
|
Loading…
Reference in a new issue