From df378357adbe00636bb1fadf7e6745c911d533ed Mon Sep 17 00:00:00 2001 From: Nikita Podvirnyi Date: Fri, 16 Aug 2024 14:33:05 +0200 Subject: [PATCH] fix: create cache folder if it doesn't exist --- src/main.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index c0ddcf2..3e4f816 100644 --- a/src/main.rs +++ b/src/main.rs @@ -109,11 +109,11 @@ fn main() -> anyhow::Result<()> { // Setup custom panic handler human_panic::setup_panic!(human_panic::metadata!()); - // Create launcher folder if it isn't + // Create launcher folder if it doesn't exist. if !LAUNCHER_FOLDER.exists() { std::fs::create_dir_all(LAUNCHER_FOLDER.as_path()).expect("Failed to create launcher folder"); - // This one is kinda critical buy well, I can't do something with it + // This one is kinda critical but well, I can't do anything about it std::fs::write(FIRST_RUN_FILE.as_path(), "").expect("Failed to create .first-run file"); // Set initial launcher language based on system language @@ -125,6 +125,12 @@ fn main() -> anyhow::Result<()> { Config::update_raw(config).expect("Failed to update config"); } + // Create cache folder if it doesn't exist. + if !CACHE_FOLDER.exists() { + std::fs::create_dir_all(CACHE_FOLDER.as_path()) + .expect("Failed to create cache folder"); + } + // Force debug output let mut force_debug = false;