From b3412173a29a3fd78e93170aa775fd1ecb38ae26 Mon Sep 17 00:00:00 2001 From: dandels Date: Sat, 15 Jul 2023 15:44:31 +0300 Subject: [PATCH] Initialize cache dir on startup. Fixes issue #5 --- src/cache/file_lists.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cache/file_lists.rs b/src/cache/file_lists.rs index be9fc2b..ab7d8ab 100644 --- a/src/cache/file_lists.rs +++ b/src/cache/file_lists.rs @@ -18,6 +18,8 @@ impl FileLists { pub async fn new(config: &Config) -> Result { let mut file_lists: HashMap<(String, u32), FileList> = HashMap::new(); + fs::create_dir_all(config.cache_dir()).await?; + // Iterates over the entries in cache_dir/file_lists//.json and deserializes them into FileLists let mut stream = fs::read_dir(config.cache_dir()).await?; while let Some(game_dir) = stream.next_entry().await? {