diff --git a/CHANGELOG.md b/CHANGELOG.md index f3fd30d..35d1d33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Fixed ### Security +## [0.7.0] - 2024-12-22 + +### Fixed + +* Path separators are now properly handled for non-Windows targets. + ## [0.6.0] - 2024-12-19 ### Fixed @@ -112,7 +118,8 @@ Non-breaking changes: - VBA project parser. - RLE decompressor for compressed streams. -[Unreleased]: https://github.com/tim-weis/ovba/compare/0.6.0...HEAD +[Unreleased]: https://github.com/tim-weis/ovba/compare/0.7.0...HEAD +[0.7.0]: https://github.com/tim-weis/ovba/compare/0.6.0...0.7.0 [0.6.0]: https://github.com/tim-weis/ovba/compare/0.5.0...0.6.0 [0.5.0]: https://github.com/tim-weis/ovba/compare/0.4.1...0.5.0 [0.4.1]: https://github.com/tim-weis/ovba/compare/0.4.0...0.4.1 diff --git a/Cargo.toml b/Cargo.toml index 4ad8ec5..546ce6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ovba" -version = "0.6.0" +version = "0.7.0" authors = ["Tim Weis "] description = "An Office VBA project parser written in 100% safe Rust." edition = "2018" diff --git a/src/lib.rs b/src/lib.rs index 5dda5a5..3bf2263 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -311,7 +311,11 @@ impl Project { .find(|&module| module.name == name) .ok_or_else(|| Error::ModuleNotFound(name.to_owned()))?; - let path = format!("/VBA\\{}", &module.stream_name); + let path = if cfg!(windows) { + format!("/VBA\\{}", &module.stream_name) + } else { + format!("/VBA/{}", &module.stream_name) + }; let offset = module.text_offset; let src_code = self.decompress_stream_from(path, offset)?; @@ -347,7 +351,10 @@ pub fn open_project(raw: Vec) -> Result { let mut container = CompoundFile::open(cursor).map_err(Error::Cfb)?; // Read *dir* stream - const DIR_STREAM_PATH: &str = r#"/VBA\dir"#; + #[cfg(target_family = "windows")] + const DIR_STREAM_PATH: &str = "/VBA\\dir"; + #[cfg(not(target_family = "windows"))] + const DIR_STREAM_PATH: &str = "/VBA/dir"; let mut buffer = Vec::new(); container