| 315 | } |
| 316 | |
| 317 | void ModelLoader::loadLibrary(std::shared_ptr<ModelLibraryLocal> library) |
| 318 | { |
| 319 | if (_modelEntryMap == nullptr) { |
| 320 | _modelEntryMap = std::make_unique<std::map<QString, std::shared_ptr<ModelEntry>>>(); |
| 321 | } |
| 322 | |
| 323 | QDirIterator it(library->getDirectory(), QDirIterator::Subdirectories); |
| 324 | while (it.hasNext()) { |
| 325 | auto pathname = it.next(); |
| 326 | QFileInfo file(pathname); |
| 327 | if (file.isFile()) { |
| 328 | if (file.suffix().toStdString() == "yml") { |
| 329 | try { |
| 330 | auto model = getModelFromPath(library, file.canonicalFilePath()); |
| 331 | (*_modelEntryMap)[model->getUUID()] = model; |
| 332 | // showYaml(model->getModel()); |
| 333 | } |
| 334 | catch (InvalidModel const&) { |
| 335 | Base::Console().log("Invalid model '%s'\n", pathname.toStdString().c_str()); |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | std::map<std::pair<QString, QString>, QString> inheritances; |
| 342 | for (auto it = _modelEntryMap->begin(); it != _modelEntryMap->end(); it++) { |
| 343 | dereference(it->second, &inheritances); |
| 344 | } |
| 345 | |
| 346 | for (auto it = _modelEntryMap->begin(); it != _modelEntryMap->end(); it++) { |
| 347 | addToTree(it->second, &inheritances); |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | void ModelLoader::loadLibraries() |
| 352 | { |
nothing calls this directly
no test coverage detected