| 433 | } |
| 434 | |
| 435 | std::unique_ptr<Instance> MOApplication::getCurrentInstance(bool forceSelect) |
| 436 | { |
| 437 | auto& m = InstanceManager::singleton(); |
| 438 | auto currentInstance = m.currentInstance(); |
| 439 | |
| 440 | if (forceSelect || !currentInstance) { |
| 441 | // clear any overrides that might have been given on the command line |
| 442 | m.clearOverrides(); |
| 443 | currentInstance = selectInstance(); |
| 444 | } else { |
| 445 | if (!QDir(currentInstance->directory()).exists()) { |
| 446 | // the previously used instance doesn't exist anymore |
| 447 | |
| 448 | // clear any overrides that might have been given on the command line |
| 449 | m.clearOverrides(); |
| 450 | |
| 451 | if (m.hasAnyInstances()) { |
| 452 | reportError(QObject::tr("Instance at '%1' not found. Select another instance.") |
| 453 | .arg(currentInstance->directory())); |
| 454 | } else { |
| 455 | reportError( |
| 456 | QObject::tr("Instance at '%1' not found. You must create a new instance") |
| 457 | .arg(currentInstance->directory())); |
| 458 | } |
| 459 | |
| 460 | currentInstance = selectInstance(); |
| 461 | } |
| 462 | } |
| 463 | |
| 464 | return currentInstance; |
| 465 | } |
| 466 | |
| 467 | std::optional<int> MOApplication::setupInstanceLoop(Instance& currentInstance, |
| 468 | PluginContainer& pc) |
nothing calls this directly
no test coverage detected