1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-04-15 11:46:56 +02:00

Add logging for failure to extract file from .zip, with check for Windows

260 path length limit
This commit is contained in:
Ivan Savenko 2025-02-25 15:28:07 +00:00
parent b372cc84e9
commit e720d06e79

View File

@ -224,7 +224,18 @@ bool ZipArchive::extract(const boost::filesystem::path & where, const std::strin
std::fstream destFile(fullName.c_str(), std::ios::out | std::ios::binary);
if (!destFile.good())
{
#ifdef VCMI_WINDOWS
if (fullName.size() < MAX_PATH)
logGlobal->error("Failed to open file '%s'", fullName.c_str());
else
logGlobal->error("Failed to open file with long path '%s' (%d characters)", fullName.c_str(), fullName.size());
#else
logGlobal->error("Failed to open file '%s'", fullName.c_str());
#endif
return false;
}
if (!extractCurrent(archive, destFile))
return false;