MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / openFile

Method openFile

TheForceEngine/TFE_Archive/labArchive.cpp:52–80  ·  view source on GitHub ↗

File Access

Source from the content-addressed store, hash-verified

50
51// File Access
52bool LabArchive::openFile(const char *file)
53{
54 if (!m_archiveOpen) { return false; }
55
56 m_file.open(m_archivePath, Stream::MODE_READ);
57 m_curFile = -1;
58 m_fileOffset = 0;
59
60 //search for this file.
61 for (u32 i = 0; i < m_header.fileCount; i++)
62 {
63 if (strcasecmp(file, &m_stringTable[m_entries[i].nameOffset]) == 0)
64 {
65 m_curFile = i;
66 break;
67 }
68 }
69
70 if (m_curFile == -1)
71 {
72 m_file.close();
73 TFE_System::logWrite(LOG_ERROR, "GOB", "Failed to load \"%s\" from \"%s\"", file, m_archivePath);
74 }
75 else
76 {
77 m_file.seek(m_entries[m_curFile].dataOffset);
78 }
79 return m_curFile > -1 ? true : false;
80}
81
82bool LabArchive::openFile(u32 index)
83{

Callers

nothing calls this directly

Calls 4

logWriteFunction · 0.85
openMethod · 0.45
closeMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected