| 330 | } |
| 331 | |
| 332 | bool 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 | |
| 361 | bool InstanceList::trashedSomething() |
| 362 | { |
no test coverage detected