diff --git a/src/common/release.rs b/src/common/release.rs index e18e3fa..ab0f5e5 100644 --- a/src/common/release.rs +++ b/src/common/release.rs @@ -10,8 +10,10 @@ use serde_json::Value; use zip::ZipArchive; lazy_static! { - pub static ref CURRENT_VERSION: Mutex = - Mutex::new(get_current_version().expect("Could not find current modpack version!\n")); + pub static ref CURRENT_VERSION: Mutex = Mutex::new(match get_current_version() { + Ok(v) => v, + Err(e) => panic!("Could not find current modpack version!: {}", e), + }); } #[derive(Debug)] diff --git a/training_mod_consts/src/config.rs b/training_mod_consts/src/config.rs index 9608822..f0462d7 100644 --- a/training_mod_consts/src/config.rs +++ b/training_mod_consts/src/config.rs @@ -64,6 +64,11 @@ impl TrainingModpackConfig { if fs::metadata(TRAINING_MODPACK_TOML_PATH).is_ok() { Err(io::Error::from(io::ErrorKind::AlreadyExists).into()) } else { + if !fs::metadata(TRAINING_MODPACK_ROOT).is_ok() { + // Root path doesn't exist, create it before trying to make the file + println!("Creating directory..."); + fs::create_dir_all(TRAINING_MODPACK_ROOT)?; + } let default_config: TrainingModpackConfig = TrainingModpackConfig::new(); let contents = toml::to_string(&default_config)?; fs::write(TRAINING_MODPACK_TOML_PATH, contents)?;