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 */
| 140 | Returns false and prints error if unsuccessful |
| 141 | */ |
| 142 | bool 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 |
no test coverage detected