| 322 | } |
| 323 | |
| 324 | void InstanceImportTask::processMultiMC() |
| 325 | { |
| 326 | QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg"); |
| 327 | auto instanceSettings = std::make_shared<INISettingsObject>(configPath); |
| 328 | |
| 329 | NullInstance instance(m_globalSettings, instanceSettings, m_stagingPath); |
| 330 | |
| 331 | // reset time played on import... because packs. |
| 332 | instance.resetTimePlayed(); |
| 333 | |
| 334 | // set a new nice name |
| 335 | instance.setName(name()); |
| 336 | |
| 337 | // if the icon was specified by user, use that. otherwise pull icon from the pack |
| 338 | if (m_instIcon != "default") { |
| 339 | instance.setIconKey(m_instIcon); |
| 340 | } else { |
| 341 | m_instIcon = instance.iconKey(); |
| 342 | |
| 343 | auto importIconPath = IconUtils::findBestIconIn(instance.instanceRoot(), m_instIcon); |
| 344 | if (importIconPath.isNull() || !QFile::exists(importIconPath)) |
| 345 | importIconPath = IconUtils::findBestIconIn(instance.instanceRoot(), "icon.png"); |
| 346 | if (!importIconPath.isNull() && QFile::exists(importIconPath)) { |
| 347 | // import icon |
| 348 | auto iconList = APPLICATION->icons(); |
| 349 | if (iconList->iconFileExists(m_instIcon)) { |
| 350 | iconList->deleteIcon(m_instIcon); |
| 351 | } |
| 352 | iconList->installIcon(importIconPath, m_instIcon); |
| 353 | } |
| 354 | } |
| 355 | emitSucceeded(); |
| 356 | } |
| 357 | |
| 358 | void InstanceImportTask::processModrinth() |
| 359 | { |
nothing calls this directly
no test coverage detected