1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Added modification time to zip.

* it is required to consider archive valid (by some tools)
This commit is contained in:
AlexVinS 2015-08-14 01:42:52 +03:00 committed by AlexVinS
parent f6e2cd16ed
commit b683c29b6e
2 changed files with 19 additions and 3 deletions

View File

@ -16,16 +16,30 @@ CZipOutputStream::CZipOutputStream(CZipSaver * owner_, zipFile archive, const st
handle(archive),
owner(owner_)
{
//zip_fileinfo fileInfo;
zip_fileinfo fileInfo;
std::time_t t = time(nullptr);
fileInfo.dosDate = 0;
struct tm * localTime = std::localtime(&t);
fileInfo.tmz_date.tm_hour = localTime->tm_hour;
fileInfo.tmz_date.tm_mday = localTime->tm_mday;
fileInfo.tmz_date.tm_min = localTime->tm_min;
fileInfo.tmz_date.tm_mon = localTime->tm_mon;
fileInfo.tmz_date.tm_sec = localTime->tm_sec;
fileInfo.tmz_date.tm_year = localTime->tm_year;
fileInfo.external_fa = 0; //???
fileInfo.internal_fa = 0;
int status = zipOpenNewFileInZip(handle,
archiveFilename.c_str(),
nullptr,//todo: use fileInfo,
&fileInfo,
nullptr,
0,
nullptr,
0,
"",
nullptr,
Z_DEFLATED,
Z_DEFAULT_COMPRESSION);

View File

@ -68,6 +68,8 @@ BOOST_AUTO_TEST_CASE(CMapFormatVCMI_Simple)
boost::filesystem::remove(path);
boost::filesystem::ofstream tmp(path);
tmp.write((const char *)serializeBuffer.getBuffer().data(),serializeBuffer.getSize());
tmp.flush();
tmp.close();
}