Fix description_contains for OpenMW plugins

This commit is contained in:
Oliver Hamlet
2025-04-27 07:23:35 +01:00
parent 2b37e15f2b
commit 2e89521963
+15 -2
View File
@@ -128,8 +128,7 @@ fn parse_plugin(state: &State, file_path: &Path) -> Option<esplugin::Plugin> {
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,8 +149,12 @@ fn parse_plugin(state: &State, file_path: &Path) -> Option<esplugin::Plugin> {
}
fn evaluate_is_master(state: &State, file_path: &Path) -> bool {
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)]
fn evaluate_many_active(state: &State, regex: &Regex) -> bool {
@@ -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"));