| 574 | } |
| 575 | |
| 576 | InstancePtr InstanceList::loadInstance(const InstanceId& id) |
| 577 | { |
| 578 | if (!m_groupsLoaded) { |
| 579 | loadGroupList(); |
| 580 | } |
| 581 | |
| 582 | auto instanceRoot = FS::PathCombine(m_instDir, id); |
| 583 | auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(instanceRoot, "instance.cfg")); |
| 584 | InstancePtr inst; |
| 585 | |
| 586 | instanceSettings->registerSetting("InstanceType", ""); |
| 587 | |
| 588 | QString inst_type = instanceSettings->get("InstanceType").toString(); |
| 589 | |
| 590 | // NOTE: Some PolyMC versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a OneSix instance |
| 591 | if (inst_type == "OneSix" || inst_type.isEmpty()) |
| 592 | { |
| 593 | inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot)); |
| 594 | } |
| 595 | else |
| 596 | { |
| 597 | inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot)); |
| 598 | } |
| 599 | qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot(); |
| 600 | return inst; |
| 601 | } |
| 602 | |
| 603 | void InstanceList::saveGroupList() |
| 604 | { |
nothing calls this directly
no test coverage detected