Commit 34dbf9de authored by Gerhard Stein's avatar Gerhard Stein

Added 32-bit zip function as possible fallback

parent 44542cbc
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <boost/property_tree/xml_parser.hpp> #include <boost/property_tree/xml_parser.hpp>
// Forward-declaration
int unzipFile(const char *input, int unzipFile(const char *input,
const char *outputDir); const char *outputDir);
...@@ -331,6 +330,7 @@ int GameDownloader::handle() ...@@ -331,6 +330,7 @@ int GameDownloader::handle()
// Go through the missing pieces // Go through the missing pieces
const auto &gameFileName = mGameFileName; const auto &gameFileName = mGameFileName;
const auto &gameName = mGameName;
{ {
gDlfrom = mProgress = 0; gDlfrom = mProgress = 0;
gDlto = 900; gDlto = 900;
...@@ -349,10 +349,12 @@ int GameDownloader::handle() ...@@ -349,10 +349,12 @@ int GameDownloader::handle()
// TODO: Now the downloaded stuff must be extracted to the games directory // TODO: Now the downloaded stuff must be extracted to the games directory
// At this point the file should be available // At this point the file should be available
const std::string destDir = gamesPath; const std::string destDir = JoinPaths(gamesPath, gameName);
if( IsFileAvailable(downloadGamePath) ) if( IsFileAvailable(downloadGamePath) )
{ {
// Try to unzip the files // Create subdirectory
CreateRecDir( destDir );
const std::string fullZipPath = JoinPaths(fullDownloadPath, gameFileName); const std::string fullZipPath = JoinPaths(fullDownloadPath, gameFileName);
const int retVal = unzipFile(fullZipPath.c_str(), destDir.c_str()); const int retVal = unzipFile(fullZipPath.c_str(), destDir.c_str());
......
...@@ -571,6 +571,17 @@ int unzipFile(const char *input, ...@@ -571,6 +571,17 @@ int unzipFile(const char *input,
uf = unzOpen64(filename_try); uf = unzOpen64(filename_try);
# endif # endif
} }
// didn't work? let try 32-bit extraction functions then
if (uf == nullptr)
{
uf = unzOpen(zipfilename);
}
if (uf == nullptr)
{
uf = unzOpen(filename_try);
}
} }
if (uf==nullptr) if (uf==nullptr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment