160 int nbProcessedFile = 0;
162 uzfile = unzOpen64(zipfile.c_str());
167 unz_global_info global_info;
168 if (unzGetGlobalInfo(uzfile, &global_info) != UNZ_OK)
176 unz_file_info64 finfo;
177 unsigned char buf[8192];
178 if (unzGetCurrentFileInfo64(uzfile,
195 if (progress !=
nullptr && progress(nbProcessedFile++, (
int)global_info.number_entry))
201 if (finfo.uncompressed_size == 0 && strlen(name) > 0 && name[strlen(name) - 1] ==
'/')
203 if (unzGoToNextFile(uzfile) != UNZ_OK)
208 if (unzOpenCurrentFile(uzfile) != UNZ_OK)
211 unzCloseCurrentFile(uzfile);
215 if (processFile(dirname, filename))
217 while ((n = unzReadCurrentFile(uzfile, buf,
sizeof(buf))) > 0)
219 if (!writeChunk((
const char*)buf, n))
221 unzCloseCurrentFile(uzfile);
227 writeChunk(
nullptr, 0);
230 unzCloseCurrentFile(uzfile);
236 unzCloseCurrentFile(uzfile);
237 if (unzGoToNextFile(uzfile) != UNZ_OK)
244 if (progress !=
nullptr)
245 progress((
int)global_info.number_entry, (
int)global_info.number_entry);
string getFileName(const string &pathFilename)
Returns the filename of path-filename string.
string getDirName(const string &pathFilename)
Strip last component from file name.
string trimRightString(const string &s, const string &drop)
trims a string at the right end