1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Removed boost::iostreams in favor of std::stream / boost::filesystem

This commit is contained in:
Ivan Savenko
2023-07-24 19:42:19 +03:00
parent fbe6c313d9
commit 21a39f0b01
17 changed files with 72 additions and 273 deletions

View File

@@ -9,7 +9,6 @@
*/
#include "StdInc.h"
#include "CZipLoader.h"
#include "FileStream.h"
#include "../ScopeGuard.h"
@@ -155,7 +154,10 @@ std::vector<std::string> ZipArchive::listFiles(const boost::filesystem::path & f
{
std::vector<std::string> ret;
unzFile file = unzOpen2_64(filename.c_str(), FileStream::GetMinizipFilefunc());
CDefaultIOApi zipAPI;
auto zipStructure = zipAPI.getApiStructure();
unzFile file = unzOpen2_64(filename.c_str(), &zipStructure);
if (unzGoToFirstFile(file) == UNZ_OK)
{
@@ -188,7 +190,10 @@ bool ZipArchive::extract(const boost::filesystem::path & from, const boost::file
bool ZipArchive::extract(const boost::filesystem::path & from, const boost::filesystem::path & where, const std::vector<std::string> & what)
{
unzFile archive = unzOpen2_64(from.c_str(), FileStream::GetMinizipFilefunc());
CDefaultIOApi zipAPI;
auto zipStructure = zipAPI.getApiStructure();
unzFile archive = unzOpen2_64(from.c_str(), &zipStructure);
auto onExit = vstd::makeScopeGuard([&]()
{
@@ -209,7 +214,7 @@ bool ZipArchive::extract(const boost::filesystem::path & from, const boost::file
if (boost::algorithm::ends_with(file, "/"))
continue;
FileStream destFile(fullName, std::ios::out | std::ios::binary);
boost::filesystem::fstream destFile(fullName, std::ios::out | std::ios::binary);
if (!destFile.good())
return false;