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

Method trashInstance

launcher/InstanceList.cpp:332–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332bool InstanceList::trashInstance(const InstanceId& id)
333{
334 auto inst = getInstanceById(id);
335 if (!inst) {
336 qDebug() << "Cannot trash instance" << id << ". No such instance is present (deleted externally?).";
337 return false;
338 }
339
340 QString cachedGroupId = m_instanceGroupIndex[id];
341
342 qDebug() << "Will trash instance" << id;
343 QString trashedLoc;
344
345 if (m_instanceGroupIndex.remove(id)) {
346 decreaseGroupCount(cachedGroupId);
347 saveGroupList();
348 }
349
350 if (!FS::trash(inst->instanceRoot(), &trashedLoc)) {
351 qDebug() << "Trash of instance" << id << "has not been completely successfully...";
352 return false;
353 }
354
355 qDebug() << "Instance" << id << "has been trashed by the launcher.";
356 m_trashHistory.push({ id, inst->instanceRoot(), trashedLoc, cachedGroupId });
357
358 return true;
359}
360
361bool InstanceList::trashedSomething()
362{

Callers 1

Calls 3

trashFunction · 0.85
instanceRootMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected