Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
After compress successfully(using Poco lib), I found that I can able to decompress a .zip file which contains files but not sub-folder
My decompress block of code :
struct UnzipStruct unzipObject;
unzipObject.unzip(source, target);
Here is MyUnzipStruct :
struct UnzipStruct
void unzip(std::string source, std::string target) {
fs::path sourcePath = fs::path(source);
std::ifstream inp(sourcePath.string(), ios::binary);
fs::path targetPath = fs::path(target);
Poco::Path targetDir(targetPath.string());
Poco::Zip::Decompress dec(inp, targetDir, false, true);
// if an error happens invoke the ZipHandlingLib::onDecompressError method
dec.EError += Poco::Delegate<UnzipStruct, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>>(this, &UnzipStruct::onDecompressError);
dec.decompressAllFiles();
dec.EError -= Poco::Delegate<UnzipStruct, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>>(this, &UnzipStruct::onDecompressError);
inp.close();
void onDecompressError(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info)
std::cerr << info.second << "\n";
} unzipObject;
Is it a bug of Poco or Did I do something wrong? Because I can extract a zip file by 7z(which contains sub-folder). The exception I get is AssertionViolationException from Poco.
–
–
–
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.