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

Method processMultiMC

launcher/InstanceImportTask.cpp:324–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324void 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
358void InstanceImportTask::processModrinth()
359{

Callers

nothing calls this directly

Calls 11

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

Tested by

no test coverage detected