| 419 | } |
| 420 | |
| 421 | void 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 | } |
nothing calls this directly
no test coverage detected