fixed fomod visable condition

This commit is contained in:
2026-03-11 00:29:38 +01:00
parent d806b331db
commit 295c9bd8c3
2 changed files with 30 additions and 4 deletions

View File

@@ -4,6 +4,7 @@
use std::{fs, io, path::Path};
use log::debug;
use serde::{Deserialize, Serialize};
use thiserror::Error;
@@ -55,6 +56,11 @@ pub struct Config {
impl Config {
pub fn load_from_file(path: impl AsRef<Path>) -> Result<Self, FOModError> {
debug!(
"Loading FOmod config from {}",
path.as_ref().to_string_lossy()
);
let data = fs::read_to_string(path)?;
let config = quick_xml::de::from_str(&data)?;
@@ -142,7 +148,7 @@ pub struct InstallStep {
#[serde(rename = "@name")]
pub name: String,
pub visible: Option<CompositeDependency>,
pub visible: Option<ModuleDependency>,
#[serde(rename = "optionalFileGroups")]
pub optional_file_groups: GroupList,
@@ -151,6 +157,7 @@ pub struct InstallStep {
#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ModuleDependency {
#[serde(rename = "@operator")]
#[serde(default)]
pub operator: DependencyOperator,
#[serde(rename = "$value")]
pub list: Vec<CompositeDependency>,
@@ -207,8 +214,11 @@ pub enum DependencyState {
Missing,
}
#[derive(Copy, Clone, Debug, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(
Copy, Clone, Debug, Default, Deserialize, Serialize, PartialEq, Eq, PartialOrd, Ord, Hash,
)]
pub enum DependencyOperator {
#[default]
And,
Or,
}