From 3c42ac507f587f9dbba51cbd8fa3135a92899088 Mon Sep 17 00:00:00 2001 From: KiritoDv Date: Thu, 16 Jan 2025 02:04:30 -0600 Subject: [PATCH] Fixed o2r creation on lib mode --- src/archive/ZWrapper.cpp | 8 ++++---- src/archive/ZWrapper.h | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/archive/ZWrapper.cpp b/src/archive/ZWrapper.cpp index b94b631..6440b62 100644 --- a/src/archive/ZWrapper.cpp +++ b/src/archive/ZWrapper.cpp @@ -8,10 +8,10 @@ #include namespace fs = std::filesystem; -miniz_cpp::zip_file mZip; ZWrapper::ZWrapper(const std::string& path) { - mPath = path; + this->mPath = path; + this->mZip = new miniz_cpp::zip_file; } int32_t ZWrapper::CreateArchive() { @@ -34,11 +34,11 @@ bool ZWrapper::AddFile(const std::string& path, std::vector data) { stream.close(); } - mZip.writebytes(path, data); + this->mZip->writebytes(path, data); return true; } int32_t ZWrapper::Close(void) { - mZip.save(this->mPath); + this->mZip->save(this->mPath); return 0; } diff --git a/src/archive/ZWrapper.h b/src/archive/ZWrapper.h index b297ac5..d1fe867 100644 --- a/src/archive/ZWrapper.h +++ b/src/archive/ZWrapper.h @@ -4,6 +4,10 @@ #include #include "BinaryWrapper.h" +namespace miniz_cpp { +class zip_file; +} + class ZWrapper : public BinaryWrapper { public: explicit ZWrapper(const std::string& path); @@ -11,4 +15,6 @@ public: int32_t CreateArchive(void) override; bool AddFile(const std::string& path, std::vector data) override; int32_t Close(void) override; + + miniz_cpp::zip_file* mZip; };