From f530a2f9d974e3bd3a6d4683057a35fde4d5721a Mon Sep 17 00:00:00 2001 From: ConfiG Date: Sun, 10 Sep 2023 01:45:39 +0300 Subject: [PATCH] still support required key --- src/project.rs | 6 ++++-- src/util/mod_file.rs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/project.rs b/src/project.rs index b001a22..5923b18 100644 --- a/src/project.rs +++ b/src/project.rs @@ -292,7 +292,8 @@ pub fn check_dependencies( if !matches!(found_in_index, Found::Some(_, _)) && !matches!(found_in_installed, Found::Some(_, _)) { - if dep.importance == DependencyImportance::Required { + if dep.importance == DependencyImportance::Required || + dep.required.is_some() && dep.required.unwrap() { fail!( "Dependency '{0}' not found in installed mods nor index! \ If this is a mod that hasn't been published yet, install it \ @@ -455,7 +456,8 @@ pub fn check_dependencies( fs::write( dep_dir.join(dep.id).join("geode-dep-options.json"), format!(r#"{{ "required": {} }}"#, - if dep.importance == DependencyImportance::Required { "true" } else { "false" }) + if dep.importance == DependencyImportance::Required || + dep.required.is_some() && dep.required.unwrap() { "true" } else { "false" }) ).nice_unwrap("Unable to save dep options"); } diff --git a/src/util/mod_file.rs b/src/util/mod_file.rs index 09267c6..6fa9050 100644 --- a/src/util/mod_file.rs +++ b/src/util/mod_file.rs @@ -195,7 +195,7 @@ pub enum DependencyImportance { #[default] Required, Recommended, - Suggested + Suggested, } #[derive(Default, Deserialize, PartialEq)] pub struct Dependency { @@ -204,6 +204,7 @@ pub struct Dependency { pub version: VersionReq, #[serde(default)] pub importance: DependencyImportance, + pub required: Option, } #[derive(Default, Deserialize, PartialEq)]