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

Method addFile

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

Source from the content-addressed store, hash-verified

824//-----------------------------------------------------------------------------
825
826bool ZipArchive::addFile(const char *filename, const char *pathInZip, bool replace /* = true */)
827{
828 FileStream f;
829 if (!f.open(filename, Torque::FS::File::Read))
830 return false;
831
832 const CentralDir *cd = findFileInfo(pathInZip);
833 if(! replace && cd && (cd->mInternalFlags & CDFileDeleted) == 0)
834 return false;
835
836 Stream *dest = openFile(pathInZip, Write);
837 if(dest == NULL)
838 {
839 f.close();
840 return false;
841 }
842
843 bool ret = dest->copyFrom(&f);
844
845 closeFile(dest);
846 f.close();
847
848 return ret;
849}
850
851bool ZipArchive::extractFile(const char *pathInZip, const char *filename, bool *crcFail /* = NULL */)
852{

Callers

nothing calls this directly

Calls 3

openMethod · 0.65
closeMethod · 0.65
copyFromMethod · 0.45

Tested by

no test coverage detected