From 9bb46616220a7e80aff88257f28a46b631318ee6 Mon Sep 17 00:00:00 2001 From: Moritz Baron Date: Thu, 14 Mar 2024 13:33:16 +0100 Subject: [PATCH] forgot omwscripts --- src/expressions.rs | 2 +- src/lib.rs | 34 +++++++++++++++++++--------------- src/parser.rs | 7 ++++++- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/src/expressions.rs b/src/expressions.rs index cf2c7d9..f56c9fc 100644 --- a/src/expressions.rs +++ b/src/expressions.rs @@ -280,7 +280,7 @@ impl Display for NOT { //////////////////////////////////////////////////////////////////////// // DESC -/// TODO The Desc predicate is a special predicate that matches strings in the header of a plugin with regular expressions. +/// The Desc predicate is a special predicate that matches strings in the header of a plugin with regular expressions. /// [DESC /regex/ A.esp] or [DESC !/regex/ A.esp] #[derive(Debug, Serialize, Deserialize)] pub struct DESC { diff --git a/src/lib.rs b/src/lib.rs index d588e57..66f30f8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -309,23 +309,27 @@ where description: None, version: None, }; - match parse_header(f) { - Ok(header) => { - data.description = Some(header.description); - - // parse semver - let version = header.version.to_string(); - match lenient_semver::parse(&version) { - Ok(v) => { - data.version = Some(v); - } - Err(e) => { - log::debug!("Error parsing version: {}", e); + + // skip if extension is omwscripts + if !file_name.to_ascii_lowercase().ends_with("omwscripts") { + match parse_header(f) { + Ok(header) => { + data.description = Some(header.description); + + // parse semver + let version = header.version.to_string(); + match lenient_semver::parse(&version) { + Ok(v) => { + data.version = Some(v); + } + Err(e) => { + log::debug!("Error parsing version: {}", e); + } } } - } - Err(e) => { - log::debug!("Error parsing header: {}, {}", e, f.display()); + Err(e) => { + log::debug!("Error parsing header: {}, {}", e, f.display()); + } } } diff --git a/src/parser.rs b/src/parser.rs index d186535..d13a287 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -30,7 +30,12 @@ pub fn new_tes3_parser() -> Parser { pub fn new_openmw_parser() -> Parser { Parser::new( - vec![".esp".into(), ".esm".into(), ".omwaddon".into()], + vec![ + ".esp".into(), + ".esm".into(), + ".omwaddon".into(), + ".omwscripts".into(), + ], ESupportedGame::OpenMW, ) }