From f68df11b994e30fc161adfebc0b82b9beb88770e Mon Sep 17 00:00:00 2001 From: Danilo Bargen Date: Mon, 4 Apr 2016 00:21:49 +0200 Subject: [PATCH] Fix creation of cache dir Resolves #22. --- src/cache.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cache.rs b/src/cache.rs index be970db..a8905f6 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -81,6 +81,12 @@ impl Cache { // Determine paths let cache_dir = try!(self.get_cache_dir()); + // Make sure that cache directory exists + debug!("Ensure cache directory {:?} exists", &cache_dir); + try!(fs::create_dir_all(&cache_dir).map_err(|e| { + UpdateError(format!("Could not create cache directory: {}", e)) + })); + // Clear cache directory // Note: This is not the best solution. Ideally we would download the // archive to a temporary directory and then swap the two directories.