Example #1
0
std::vector<std::string> ZipArchive::listFiles(boost::filesystem::path filename)
{
	std::vector<std::string> ret;

	unzFile file = unzOpen2_64(filename.c_str(), FileStream::GetMinizipFilefunc());

	if (unzGoToFirstFile(file) == UNZ_OK)
	{
		do
		{
			unz_file_info64 info;
			std::vector<char> filename;

			unzGetCurrentFileInfo64 (file, &info, nullptr, 0, nullptr, 0, nullptr, 0);

			filename.resize(info.size_filename);
			// Get name of current file. Contrary to docs "info" parameter can't be null
			unzGetCurrentFileInfo64 (file, &info, filename.data(), filename.size(), nullptr, 0, nullptr, 0);

			ret.push_back(std::string(filename.data(), filename.size()));
		}
		while (unzGoToNextFile(file) == UNZ_OK);
	}
	unzClose(file);

	return ret;
}