MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / loadInstance

Method loadInstance

launcher/InstanceList.cpp:624–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622}
623
624InstancePtr InstanceList::loadInstance(const InstanceId& id)
625{
626 if (!m_groupsLoaded) {
627 loadGroupList();
628 }
629
630 auto instanceRoot = FS::PathCombine(m_instDir, id);
631 auto instanceSettings = std::make_shared<INISettingsObject>(FS::PathCombine(instanceRoot, "instance.cfg"));
632 InstancePtr inst;
633
634 instanceSettings->registerSetting("InstanceType", "");
635
636 QString inst_type = instanceSettings->get("InstanceType").toString();
637
638 // NOTE: Some launcher versions didn't save the InstanceType properly. We will just bank on the probability that this is probably a
639 // OneSix instance
640 if (inst_type == "OneSix" || inst_type.isEmpty()) {
641 inst.reset(new MinecraftInstance(m_globalSettings, instanceSettings, instanceRoot));
642 } else {
643 inst.reset(new NullInstance(m_globalSettings, instanceSettings, instanceRoot));
644 }
645 qDebug() << "Loaded instance " << inst->name() << " from " << inst->instanceRoot();
646 return inst;
647}
648
649void InstanceList::increaseGroupCount(const QString& group)
650{

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected