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; };