MCPcopy Create free account
hub / github.com/MultiMC/Launcher / loadInstance

Method loadInstance

launcher/InstanceList.cpp:537–566  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

535}
536
537InstancePtr 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
568void InstanceList::saveGroupList()
569{

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected