From b4a506efa0d7e4300c65ff02b0c8fa581d9b4e1c Mon Sep 17 00:00:00 2001 From: Frederik Delaere Date: Thu, 10 Oct 2019 15:57:47 +0200 Subject: [PATCH] bugfix, new installations couldn't create a cache --- src/cache.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cache.rs b/src/cache.rs index 6441946..be64616 100755 --- a/src/cache.rs +++ b/src/cache.rs @@ -132,7 +132,11 @@ pub fn update(modulepath: &str, shell: &str) -> bool { let mut index_default: i32 = 0; let file_str = format!("{}/{}", modulepath, MODULESINDEX); - let num_modules = count_modules_in_cache(&PathBuf::from(&file_str)); + let num_modules = if Path::new(&file_str).exists() { + count_modules_in_cache(&PathBuf::from(&file_str)) + } else { + 0 + }; if shell == "progressbar" { echo("", shell);