From 14ae6d623b82f0e0a65c2bfbc935cf58a9df7aa8 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 24 Nov 2015 10:30:52 +0100 Subject: [PATCH] Refactor: Outsource filepath building --- src/storage/backend.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/storage/backend.rs b/src/storage/backend.rs index b83e4366..d89ebd76 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -67,7 +67,7 @@ impl StorageBackend { { let written = p.write(f.contents()); if let Ok(string) = written { - let path = self.basepath + &f.id()[..]; + let path = self.build_filepath(&f); debug!("Writing file: {}", path); Ok(Ok(())) } else { @@ -92,6 +92,10 @@ impl StorageBackend { pub fn get_file_by_id(id: FileID) -> Option { } + fn build_filepath(&self, f: &File) -> String { + self.basepath + &f.id()[..] + } + } #[derive(Debug)]