| 512 | } |
| 513 | |
| 514 | std::unique_ptr<Instance> InstanceManager::currentInstance() const |
| 515 | { |
| 516 | const QString profile = m_overrideProfileName ? *m_overrideProfileName : ""; |
| 517 | |
| 518 | const QString name = m_overrideInstanceName ? *m_overrideInstanceName |
| 519 | : GlobalSettings::currentInstance(); |
| 520 | |
| 521 | if (!allowedToChangeInstance()) { |
| 522 | // force portable instance |
| 523 | return std::make_unique<Instance>(portablePath(), true, profile); |
| 524 | } |
| 525 | |
| 526 | if (name.isEmpty()) { |
| 527 | if (portableInstanceExists()) { |
| 528 | // use portable |
| 529 | return std::make_unique<Instance>(portablePath(), true, profile); |
| 530 | } else { |
| 531 | // no instance set |
| 532 | return {}; |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | return std::make_unique<Instance>(instancePath(name), false, profile); |
| 537 | } |
| 538 | |
| 539 | void InstanceManager::clearCurrentInstance() |
| 540 | { |
no test coverage detected