Skip to content

Commit

Permalink
SporeModManager: remove unused Zip::GetFileList() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosalie241 committed Nov 20, 2023
1 parent b4c78ab commit 3fa3a86
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 48 deletions.
5 changes: 0 additions & 5 deletions SporeModManager/SporeModManagerHelpers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,6 @@ namespace SporeModManagerHelpers
/// </summary>
bool CloseFile(ZipFile zipFile);

/// <summary>
/// Retrieves the file list of a zip file
/// </summary>
bool GetFileList(ZipFile zipFile, std::vector<std::filesystem::path>& fileList);

/// <summary>
/// Extracts file to outputFile
/// </summary>
Expand Down
43 changes: 0 additions & 43 deletions SporeModManager/SporeModManagerHelpers/Zip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,47 +131,6 @@ bool Zip::CloseFile(ZipFile zipFile)
return unzClose(zipFile) == UNZ_OK;
}

bool Zip::GetFileList(ZipFile zipFile, std::vector<std::filesystem::path>& fileList)
{
unz_global_info64 zipInfo;

if (unzGetGlobalInfo64(zipFile, &zipInfo) != UNZ_OK)
{
std::cerr << "unzGetGlobalInfo() Failed!" << std::endl;
return false;
}

for (uint64_t i = 0; i < zipInfo.number_entry; i++)
{
unz_file_info fileInfo;
char fileName[2048];

// skip the file when we can't retrieve file info
if (unzGetCurrentFileInfo(zipFile, &fileInfo, fileName, 2048, nullptr, 0, nullptr, 0) != UNZ_OK)
{
continue;
}

fileList.push_back(fileName);

// break when we've iterated over all entries
if ((uint64_t)(i + 1) >= zipInfo.number_entry)
{
break;
}

// move to next file
if (unzGoToNextFile(zipFile) != UNZ_OK)
{
unzClose(zipFile);
std::cerr << "unzGoToNextFile() Failed!" << std::endl;
return false;
}
}

return true;
}

bool Zip::ExtractFile(ZipFile zipFile, std::filesystem::path file, std::filesystem::path outputFile)
{
std::vector<char> buffer(UNZIP_READ_SIZE);
Expand Down Expand Up @@ -254,7 +213,5 @@ bool Zip::ExtractFile(ZipFile zipFile, std::filesystem::path file, std::vector<c

unzCloseCurrentFile(zipFile);
return true;


}

0 comments on commit 3fa3a86

Please sign in to comment.