MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / processMultiMC

Method processMultiMC

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

Source from the content-addressed store, hash-verified

292}
293
294void InstanceImportTask::processMultiMC()
295{
296 QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg");
297 auto instanceSettings = std::make_shared<INISettingsObject>(configPath);
298
299 NullInstance instance(m_globalSettings, instanceSettings, m_stagingPath);
300
301 // reset time played on import... because packs.
302 instance.resetTimePlayed();
303
304 // set a new nice name
305 instance.setName(name());
306
307 // if the icon was specified by user, use that. otherwise pull icon from the pack
308 if (m_instIcon != "default") {
309 instance.setIconKey(m_instIcon);
310 } else {
311 m_instIcon = instance.iconKey();
312
313 auto importIconPath = IconUtils::findBestIconIn(instance.instanceRoot(), m_instIcon);
314 if (!importIconPath.isNull() && QFile::exists(importIconPath)) {
315 // import icon
316 auto iconList = APPLICATION->icons();
317 if (iconList->iconFileExists(m_instIcon)) {
318 iconList->deleteIcon(m_instIcon);
319 }
320 iconList->installIcons({ importIconPath });
321 }
322 }
323 emitSucceeded();
324}
325
326void InstanceImportTask::processModrinth()
327{

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
installIconsMethod · 0.80
setNameMethod · 0.45
iconKeyMethod · 0.45

Tested by

no test coverage detected