MCPcopy Create free account
hub / github.com/AbyssEngine/AbyssEngineOld / fileList

Method fileList

src/Abyss/FileSystem/MPQ.cpp:108–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106InputStream MPQ::load(const std::string_view fileName) { return InputStream(std::make_unique<MPQStream>(_stormMpq, fixPath(fileName))); }
107
108std::vector<std::string> MPQ::fileList() {
109 std::vector<std::string> result;
110
111 if (!has("(listfile)")) {
112 Common::Log::error("MPQ does not contain a listfile.");
113 }
114
115 auto stream = load("(listfile)");
116
117 std::string line;
118 while (true) {
119 std::getline(stream, line);
120 if (stream.eof()) {
121 break;
122 }
123
124 // Remove the \r character from the line
125 line.erase(std::remove(line.begin(), line.end(), '\r'), line.end());
126
127 result.push_back(line);
128 }
129
130 return result;
131}
132
133} // namespace Abyss::FileSystem

Callers

nothing calls this directly

Calls 1

errorFunction · 0.85

Tested by

no test coverage detected