1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Add more logging to mod downloading process

This commit is contained in:
Ivan Savenko 2023-09-11 18:10:07 +03:00
parent fc6fc31a02
commit e4aa981925
3 changed files with 29 additions and 4 deletions

View File

@ -764,10 +764,10 @@ void CModListView::installMods(QStringList archives)
enableMod(mod);
}
checkManagerErrors();
for(QString archive : archives)
QFile::remove(archive);
checkManagerErrors();
}
void CModListView::on_refreshButton_clicked()

View File

@ -39,6 +39,11 @@ QString detectModArchive(QString path, QString modName)
}
}
}
logGlobal->error("Failed to detect mod path in archive!");
logGlobal->debug("List of file in archive:");
for(auto file : files)
logGlobal->debug("%s", file.c_str());
return "";
}

View File

@ -157,7 +157,15 @@ std::vector<std::string> ZipArchive::listFiles(const boost::filesystem::path & f
unzFile file = unzOpen2_64(filename.c_str(), FileStream::GetMinizipFilefunc());
if (unzGoToFirstFile(file) == UNZ_OK)
if (file == nullptr)
{
logGlobal->error("Failed to open file '%s'! Unable to list files!", filename.string());
return {};
}
int result = unzGoToFirstFile(file);
if (result == UNZ_OK)
{
do
{
@ -171,9 +179,21 @@ std::vector<std::string> ZipArchive::listFiles(const boost::filesystem::path & f
unzGetCurrentFileInfo64(file, &info, zipFilename.data(), static_cast<uLong>(zipFilename.size()), nullptr, 0, nullptr, 0);
ret.emplace_back(zipFilename.data(), zipFilename.size());
result = unzGoToNextFile(file);
}
while (result == UNZ_OK);
if (result != UNZ_OK && result != UNZ_END_OF_LIST_OF_FILE)
{
logGlobal->error("Failed to list file from '%s'! Error code %d", filename.string(), result);
}
while (unzGoToNextFile(file) == UNZ_OK);
}
else
{
logGlobal->error("Failed to list files from '%s'! Error code %d", filename.string(), result);
}
unzClose(file);
return ret;