From 2e8952196360aec1cc40eb7a359b6b034a30a68a Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Sun, 27 Apr 2025 07:16:08 +0100 Subject: [PATCH] Fix description_contains for OpenMW plugins --- src/function/eval.rs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/function/eval.rs b/src/function/eval.rs index e1b0386..8d71e98 100644 --- a/src/function/eval.rs +++ b/src/function/eval.rs @@ -128,8 +128,7 @@ fn parse_plugin(state: &State, file_path: &Path) -> Option { use esplugin::GameId; let game_id = match state.game_type { - GameType::OpenMW => return None, - GameType::Morrowind => GameId::Morrowind, + GameType::Morrowind | GameType::OpenMW => GameId::Morrowind, GameType::Oblivion => GameId::Oblivion, GameType::Skyrim => GameId::Skyrim, GameType::SkyrimSE | GameType::SkyrimVR => GameId::SkyrimSE, @@ -150,7 +149,11 @@ fn parse_plugin(state: &State, file_path: &Path) -> Option { } fn evaluate_is_master(state: &State, file_path: &Path) -> bool { - parse_plugin(state, file_path).is_some_and(|plugin| plugin.is_master_file()) + if state.game_type == GameType::OpenMW { + false + } else { + parse_plugin(state, file_path).is_some_and(|plugin| plugin.is_master_file()) + } } #[expect(clippy::iter_over_hash_type)] @@ -526,6 +529,16 @@ mod tests { ); } + #[test] + fn parse_plugin_should_parse_openmw_plugins() { + let mut state = state(Path::new("./tests/testing-plugins/Morrowind/Data Files")); + state.game_type = GameType::OpenMW; + + let plugin = parse_plugin(&state, Path::new("Blank.esp")); + + assert!(plugin.is_some()); + } + #[test] fn function_file_path_eval_should_return_true_if_the_file_exists_relative_to_the_data_path() { let function = Function::FilePath(PathBuf::from("Cargo.toml"));