| 535 | } |
| 536 | |
| 537 | InstancePtr InstanceList::loadInstance(const InstanceId& id) |
| 538 | { |
| 539 | if(!m_groupsLoaded) |
| 540 | { |
| 541 | loadGroupList(); |
| 542 | } |
| 543 | |
| 544 | auto instanceRoot = FS::PathCombine(m_instDir, id); |
| 545 | auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(instanceRoot, "instance.cfg")); |
| 546 | InstancePtr inst; |
| 547 | |
| 548 | instanceSettings->registerSetting("InstanceType", "Legacy"); |
| 549 | |
| 550 | QString inst_type = instanceSettings->get("InstanceType").toString(); |
| 551 | |
| 552 | if (inst_type == "OneSix" || inst_type == "Nostalgia") |
| 553 | { |
| 554 | inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot)); |
| 555 | } |
| 556 | else if (inst_type == "Legacy") |
| 557 | { |
| 558 | inst.reset(new LegacyInstance(m_globalSettings, instanceSettings, instanceRoot)); |
| 559 | } |
| 560 | else |
| 561 | { |
| 562 | inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot)); |
| 563 | } |
| 564 | qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot(); |
| 565 | return inst; |
| 566 | } |
| 567 | |
| 568 | void InstanceList::saveGroupList() |
| 569 | { |
nothing calls this directly
no test coverage detected