MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / loadInstance

Method loadInstance

launcher/InstanceList.cpp:576–601  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

574}
575
576InstancePtr 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
603void InstanceList::saveGroupList()
604{

Callers

nothing calls this directly

Calls 8

PathCombineFunction · 0.85
isEmptyMethod · 0.80
instanceRootMethod · 0.80
registerSettingMethod · 0.45
toStringMethod · 0.45
getMethod · 0.45
resetMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected