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

Method processMultiMC

launcher/InstanceImportTask.cpp:421–457  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419}
420
421void InstanceImportTask::processMultiMC()
422{
423 QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg");
424 auto instanceSettings = std::make_shared<INISettingsObject>(configPath);
425 instanceSettings->registerSetting("InstanceType", "Legacy");
426
427 NullInstance instance(m_globalSettings, instanceSettings, m_stagingPath);
428
429 // reset time played on import... because packs.
430 instance.resetTimePlayed();
431
432 // set a new nice name
433 instance.setName(m_instName);
434
435 // if the icon was specified by user, use that. otherwise pull icon from the pack
436 if (m_instIcon != "default")
437 {
438 instance.setIconKey(m_instIcon);
439 }
440 else
441 {
442 m_instIcon = instance.iconKey();
443
444 auto importIconPath = IconUtils::findBestIconIn(instance.instanceRoot(), m_instIcon);
445 if (!importIconPath.isNull() && QFile::exists(importIconPath))
446 {
447 // import icon
448 auto iconList = APPLICATION->icons();
449 if (iconList->iconFileExists(m_instIcon))
450 {
451 iconList->deleteIcon(m_instIcon);
452 }
453 iconList->installIcons({importIconPath});
454 }
455 }
456 emitSucceeded();
457}

Callers

nothing calls this directly

Calls 12

PathCombineFunction · 0.85
findBestIconInFunction · 0.85
resetTimePlayedMethod · 0.80
setIconKeyMethod · 0.80
instanceRootMethod · 0.80
iconsMethod · 0.80
iconFileExistsMethod · 0.80
deleteIconMethod · 0.80
installIconsMethod · 0.80
registerSettingMethod · 0.45
setNameMethod · 0.45
iconKeyMethod · 0.45

Tested by

no test coverage detected