Skip to content

Commit

Permalink
forgot omwscripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rfuzzo committed Mar 14, 2024
1 parent d0e9da9 commit 9bb4661
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
34 changes: 19 additions & 15 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
Expand Down

0 comments on commit 9bb4661

Please sign in to comment.