Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to implement a way for my game engine to unzip files that it needs. In order to do this I use a library called ZipLib, but I'm having a problem where the ZipArchive::GetEntry() function returns en empty entry. The weird part is that it only does that in 64-bit builds. 32-bit builds run fine even though the code is exactly the same.

Here's my code:
std::string LoadSingleFileContent(const std::string& path)
{
	ZipArchive::Ptr archive = ZipFile::Open(m_gameRootPath + DATA_PAK_PATH);
	if (archive == NULL)
	{
		throw(std::exception("Failed to load PAK archive."));
	}

	ZipArchiveEntry::Ptr entry = archive->GetEntry(path); // returns invalid entry on 64-bit builds only

	std::istream* compressionStream = entry->GetDecompressionStream(); // since entry is invalid, this crashes
	std::string content(std::istreambuf_iterator<char>(*compressionStream), {});

	return content;
}


What I have tried:

Nothing. I have been unable to find any information about this issue :/
Posted
Updated 10-Jun-19 18:45pm
v2

1 solution

Though I know nothing about ZipLib, including whether it is compatible with x64, there is a zlib repository at GitHub - txwizard/zlib_x64_and_ARM: Port of zlib to Intel x64, AMR, and ARM64[^] that I know is compatible, because I ported and tested it. Although my final objective was an ARM processor, I had to build for x64 on Windows before I repeated the operation for ARM64. The project defines four platforms, Win32, x64, ARM, and ARM64. Take the x64 build and run with it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900