diff --git a/Cargo.toml b/Cargo.toml index 27d20d8..a3e5e00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,9 +27,11 @@ byteorder = "1.5.0" rayon = { version = "1.10.0", optional = true} serde = { version = "1.0.217", optional = true, features = ["derive"] } serde-hex = { version = "0.1.0", optional = true } -indexmap = "2.7.1" +indexmap = "2.10.0" crc32fast = "1.4.2" async-trait = { version = "0.1.88", optional = true} +glacier-ini = {git="https://github.com/dafitius/GlacierFormats-rs"} + [features] default = ["rayon", "path-list", "serde"] diff --git a/src/lib.rs b/src/lib.rs index 3faa6d0..0f8a12c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,7 @@ use serde::{Deserialize, Serialize}; pub mod encryption; pub mod misc; pub mod resource; -pub mod utils; +pub(crate) mod utils; #[derive(Debug, PartialEq, Clone, Copy)] #[cfg_attr(feature = "serde", derive(Deserialize, Serialize))] diff --git a/src/misc/mod.rs b/src/misc/mod.rs index 2010273..5b5b89d 100644 --- a/src/misc/mod.rs +++ b/src/misc/mod.rs @@ -1,3 +1,6 @@ +#[deprecated( + since = "1.2.0", + note = "Replaced by dedicated glacier-ini crate")] pub mod ini_file_system; pub mod resource_id; diff --git a/src/resource/pdefs/h2016_parser.rs b/src/resource/pdefs/h2016_parser.rs index e36a7c9..c36ea5a 100644 --- a/src/resource/pdefs/h2016_parser.rs +++ b/src/resource/pdefs/h2016_parser.rs @@ -107,7 +107,7 @@ impl PackageDefinitionParser for H2016Parser { } fn try_read_partition_name(lines: Vec<&str>) -> Option { - let reg = regex!(r"## --- (?:DLC|Chunk )\d{2} (.*)"); + let reg = regex!(r"## --- +(?:DLC|Chunk )\d{2} (.*)"); for line in lines { if reg.is_match(line) { if let Some(m) = reg.captures_iter(line).next() { diff --git a/src/resource/pdefs/hm2_parser.rs b/src/resource/pdefs/hm2_parser.rs index 716a321..e92d94a 100644 --- a/src/resource/pdefs/hm2_parser.rs +++ b/src/resource/pdefs/hm2_parser.rs @@ -76,7 +76,7 @@ impl PackageDefinitionParser for HM2Parser { } fn try_read_partition_name(lines: Vec<&str>) -> Option { - let reg = regex!(r"// --- (?:DLC|Chunk) \d{2} (.*)"); + let reg = regex!(r"// --- +(?:DLC|Chunk) \d{2} (.*)"); for line in lines { if reg.is_match(line) { if let Some(m) = reg.captures_iter(line).next() { diff --git a/src/resource/pdefs/mod.rs b/src/resource/pdefs/mod.rs index adac860..140c2ec 100644 --- a/src/resource/pdefs/mod.rs +++ b/src/resource/pdefs/mod.rs @@ -1,14 +1,14 @@ use std::fmt::Display; use std::path::PathBuf; use std::str::FromStr; - +use glacier_ini::ini_file::IniFileError; +use glacier_ini::IniFileSystem; use lazy_regex::regex; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use thiserror::Error; use crate::encryption::xtea::XteaError; -use crate::misc::ini_file_system::{IniFileError, IniFileSystem}; use crate::misc::resource_id::ResourceID; use crate::resource::pdefs::GameDiscoveryError::InvalidRuntimePath; use crate::resource::pdefs::PackageDefinitionSource::{HM2, HM2016, HM3}; @@ -315,7 +315,7 @@ impl GamePaths { let thumbs_path = retail_directory.join("thumbs.dat"); // Parse the thumbs file, so we can find the runtime path. - let thumbs = IniFileSystem::from(thumbs_path.as_path()) + let thumbs = IniFileSystem::from_path(thumbs_path.as_path()) .map_err(GameDiscoveryError::FailedToParseThumbsFile)?; let app_options = &thumbs.root()["application"]; diff --git a/src/utils.rs b/src/utils.rs index a4fe9e2..8f4cf6c 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -2,7 +2,7 @@ use std::ffi::OsString; use std::fs; use std::path::{Component, Path, PathBuf}; -pub fn read_file_names(path: &Path) -> Vec { +pub(crate) fn read_file_names(path: &Path) -> Vec { match fs::read_dir(path) { Ok(entries) => entries .flatten() @@ -15,7 +15,7 @@ pub fn read_file_names(path: &Path) -> Vec { } } -pub fn normalize_path(path: &Path) -> PathBuf { +pub(crate) fn normalize_path(path: &Path) -> PathBuf { let mut components = path.components().peekable(); let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() { components.next();