| 1209 | } |
| 1210 | |
| 1211 | void ConfigManager::loadUserConfig(const std::string& fileName) |
| 1212 | { |
| 1213 | if (fileName.empty()) |
| 1214 | return; |
| 1215 | |
| 1216 | mFilenameUserCfg = fileName; |
| 1217 | |
| 1218 | OD_LOG_INF("Load user config file: " + fileName); |
| 1219 | std::stringstream defFile; |
| 1220 | if(!Helper::readFileWithoutComments(fileName, defFile)) |
| 1221 | { |
| 1222 | OD_LOG_INF("Couldn't read " + fileName); |
| 1223 | return; |
| 1224 | } |
| 1225 | |
| 1226 | mUserConfig.clear(); |
| 1227 | mUserConfig.resize(Config::Ctg::TOTAL); |
| 1228 | |
| 1229 | std::string nextParam; |
| 1230 | defFile >> nextParam; |
| 1231 | if (nextParam != "[Configuration]") |
| 1232 | { |
| 1233 | OD_LOG_WRN("Invalid User configuration start format. Line was " + nextParam); |
| 1234 | return; |
| 1235 | } |
| 1236 | |
| 1237 | std::string value; |
| 1238 | Config::Ctg category = Config::Ctg::NONE; |
| 1239 | while(defFile.good()) |
| 1240 | { |
| 1241 | if (!(defFile >> nextParam)) |
| 1242 | { |
| 1243 | break; |
| 1244 | } |
| 1245 | else if (nextParam == "[/Configuration]") |
| 1246 | { |
| 1247 | break; |
| 1248 | } |
| 1249 | else if (nextParam == "[Audio]") |
| 1250 | { |
| 1251 | category = Config::Ctg::AUDIO; |
| 1252 | continue; |
| 1253 | } |
| 1254 | else if (nextParam == "[Video]") |
| 1255 | { |
| 1256 | category = Config::Ctg::VIDEO; |
| 1257 | continue; |
| 1258 | } |
| 1259 | else if (nextParam == "[Input]") |
| 1260 | { |
| 1261 | category = Config::Ctg::INPUT; |
| 1262 | continue; |
| 1263 | } |
| 1264 | else if (nextParam == "[Game]") |
| 1265 | { |
| 1266 | category = Config::Ctg::GAME; |
| 1267 | continue; |
| 1268 | } |
nothing calls this directly
no test coverage detected