From 63fe7b4c8e85e56681df75aa3e8bee6b041ea0e0 Mon Sep 17 00:00:00 2001 From: Tim Weis Date: Sat, 21 Dec 2024 20:36:01 +0100 Subject: [PATCH 1/2] path separator * Fixes an issue with CFB path separators. --- src/lib.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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 From d3f6a3cb62cf8c1e9cbaa684f3df9f2f00f5d332 Mon Sep 17 00:00:00 2001 From: Tim Weis Date: Sun, 22 Dec 2024 11:38:40 +0100 Subject: [PATCH 2/2] Prepared release 0.7.0 --- CHANGELOG.md | 9 ++++++++- Cargo.toml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) 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"