Skip to content

Commit

Permalink
still support required key
Browse files Browse the repository at this point in the history
  • Loading branch information
cgytrus committed Sep 9, 2023
1 parent 6136a99 commit f530a2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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");
}

Expand Down
3 changes: 2 additions & 1 deletion src/util/mod_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub enum DependencyImportance {
#[default]
Required,
Recommended,
Suggested
Suggested,
}
#[derive(Default, Deserialize, PartialEq)]
pub struct Dependency {
Expand All @@ -204,6 +204,7 @@ pub struct Dependency {
pub version: VersionReq,
#[serde(default)]
pub importance: DependencyImportance,
pub required: Option<bool>,
}

#[derive(Default, Deserialize, PartialEq)]
Expand Down

0 comments on commit f530a2f

Please sign in to comment.