MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / readCentralDirectory

Method readCentralDirectory

Engine/source/core/util/zip/zipArchive.cpp:73–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71//-----------------------------------------------------------------------------
72
73bool ZipArchive::readCentralDirectory()
74{
75 mEntries.clear();
76 SAFE_DELETE(mRoot);
77 mRoot = new ZipEntry;
78 mRoot->mName = "";
79 mRoot->mIsDirectory = true;
80 mRoot->mCD.setFilename("");
81
82 if(! mEOCD.findInStream(mStream))
83 return false;
84
85 if(! mEOCD.read(mStream))
86 return false;
87
88 if(mEOCD.mDiskNum != mEOCD.mStartCDDiskNum ||
89 mEOCD.mNumEntriesInThisCD != mEOCD.mTotalEntriesInCD)
90 {
91 if(isVerbose())
92 Con::errorf("ZipArchive::readCentralDirectory - %s: Zips that span multiple disks are not supported.", mFilename ? mFilename : "<no filename>");
93 return false;
94 }
95
96 if(! mStream->setPosition(mEOCD.mCDOffset))
97 return false;
98
99 for(S32 i = 0;i < mEOCD.mNumEntriesInThisCD;++i)
100 {
101 ZipEntry *ze = new ZipEntry;
102 if(! ze->mCD.read(mStream))
103 {
104 delete ze;
105
106 if(isVerbose())
107 Con::errorf("ZipArchive::readCentralDirectory - %s: Error reading central directory.", mFilename ? mFilename : "<no filename>");
108 return false;
109 }
110
111 insertEntry(ze);
112 }
113
114 return true;
115}
116
117void ZipArchive::dumpCentralDirectory(ZipEntry* entry, String* indent)
118{

Callers

nothing calls this directly

Calls 6

findInStreamMethod · 0.80
errorfFunction · 0.50
clearMethod · 0.45
setFilenameMethod · 0.45
readMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected