MCPcopy Create free account
hub / github.com/Tencent/libpag / ReadConfigFile

Function ReadConfigFile

exporter/src/config/ConfigFile.cpp:196–233  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196bool ReadConfigFile(ConfigParam* configParam) {
197 if (!configParam) {
198 return false;
199 }
200
201 const auto& configPath = GetConfigPath();
202 if (configPath.empty()) {
203 return false;
204 }
205
206 std::string filename = configPath + "PAGConfig.xml";
207 if (!FileIsExist(filename)) {
208 WriteDefaultConfigFile(filename.c_str());
209 return false;
210 }
211
212 XMLDocument doc;
213 if (doc.LoadFile(filename.c_str()) != XML_SUCCESS) {
214 return false;
215 }
216
217 XMLElement* rootElement = doc.FirstChildElement("pag-exporter");
218 if (!rootElement) {
219 return false;
220 }
221
222 XMLElement* commonElement = rootElement->FirstChildElement("common");
223 XMLElement* bitmapElement = rootElement->FirstChildElement("bitmap");
224
225 if (!commonElement || !bitmapElement) {
226 return false;
227 }
228
229 ReadCommonConfig(commonElement, configParam);
230 ReadBitmapConfig(bitmapElement, configParam);
231
232 return true;
233}
234
235void WriteConfigFile(ConfigParam* configParam) {
236 if (!configParam) {

Callers 3

checkParamValidMethod · 0.85
initMethod · 0.85
ConfigWindowMethod · 0.85

Calls 6

GetConfigPathFunction · 0.85
FileIsExistFunction · 0.85
WriteDefaultConfigFileFunction · 0.85
ReadCommonConfigFunction · 0.85
ReadBitmapConfigFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected