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

Method undoTrashInstance

launcher/InstanceList.cpp:322–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

320}
321
322void InstanceList::undoTrashInstance() {
323 if (m_trashHistory.empty()) {
324 qWarning() << "Nothing to recover from trash.";
325 return;
326 }
327
328 auto top = m_trashHistory.pop();
329
330 while (QDir(top.polyPath).exists()) {
331 top.id += "1";
332 top.polyPath += "1";
333 }
334
335 qDebug() << "Moving" << top.trashPath << "back to" << top.polyPath;
336 QFile(top.trashPath).rename(top.polyPath);
337
338 m_instanceGroupIndex[top.id] = top.groupName;
339 m_groupNameCache.insert(top.groupName);
340
341 saveGroupList();
342 emit instancesChanged();
343}
344
345void InstanceList::deleteInstance(const InstanceId& id)
346{

Callers

nothing calls this directly

Calls 6

QFileClass · 0.85
existsMethod · 0.80
renameMethod · 0.80
insertMethod · 0.80
QDirClass · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected