MCPcopy Create free account
hub / github.com/cuberite/cuberite / ParsePackageFile

Function ParsePackageFile

Tools/ToLuaDoxy/ToLuaDoxy.cpp:142–166  ·  view source on GitHub ↗

Parses the specified package file into a list of $cfile-included files and all the other contents Returns true if successful. Returns false and prints error if unsuccessful */

Source from the content-addressed store, hash-verified

140Returns false and prints error if unsuccessful
141*/
142bool ParsePackageFile(const AString & a_FileName, AStrings & a_CFiles, AStrings & a_DirectContentsLines)
143{
144 std::ifstream PkgFile(a_FileName.c_str());
145 if (PkgFile.fail())
146 {
147 std::cerr << "Cannot open the package file " << a_FileName << "." << std::endl;
148 return false;
149 }
150
151 while (!PkgFile.eof())
152 {
153 AString Line;
154 std::getline(PkgFile, Line);
155 Line = TrimString(Line);
156 if (strncmp(Line.c_str(), "$cfile \"", 8) == 0)
157 {
158 a_CFiles.push_back(Line.substr(8, Line.length() - 9));
159 }
160 else
161 {
162 a_DirectContentsLines.push_back(Line);
163 }
164 }
165 return true;
166}
167
168
169

Callers 1

mainFunction · 0.85

Calls 2

TrimStringFunction · 0.85
c_strMethod · 0.80

Tested by

no test coverage detected