From e6a87a17987de5d8e462634777df31e2cae5c1a6 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 4 Nov 2020 20:57:50 -0500 Subject: added IPlugin::registered() removed useless dummy interfaces because init() isn't called anymore python plugins currently broken because init() isn't called on them fixed create instance dialog being shown on startup even if portable instance existed display a message when the last instance can't be found fixed instance manager dialog failing to open the portable instance --- src/main.cpp | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8f7af77d..7b489aee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -272,22 +272,22 @@ std::optional handleCommandLine( return {}; } -void openInstanceManager(PluginContainer& pc, QWidget* parent); - std::optional selectInstance() { + auto& m = InstanceManager::instance(); + NexusInterface ni(nullptr); PluginContainer pc(nullptr); pc.loadPlugins(); - if (InstanceManager::instance().instancePaths().empty()) { + if (m.instancePaths().empty() && !m.portableInstanceExists()) { // no instances configured CreateInstanceDialog dlg(pc, nullptr); if (dlg.exec() != QDialog::Accepted) { return {}; } - return InstanceManager::instance().currentInstance(); + return m.currentInstance(); } @@ -302,7 +302,7 @@ std::optional selectInstance() return {}; } - return InstanceManager::instance().currentInstance(); + return m.currentInstance(); } enum class SetupInstanceResults @@ -650,13 +650,36 @@ int doOneRun( // resets things when MO is "restarted" resetForRestart(cl); - auto currentInstance = InstanceManager::instance().currentInstance(); + auto& m = InstanceManager::instance(); + auto currentInstance = m.currentInstance(); if (!currentInstance) { currentInstance = selectInstance(); - if (!currentInstance) + if (!currentInstance) { return 1; + } + } + else + { + if (!currentInstance->directory().exists()) { + // the previously used instance doesn't exist anymore + + if (m.instanceNames().empty() && !m.portableInstanceExists()) { + criticalOnTop(QObject::tr( + "Instance at '%1' not found. You must create a new instance") + .arg(currentInstance->directory().absolutePath())); + } else { + criticalOnTop(QObject::tr( + "Instance at '%1' not found. Select another instance.") + .arg(currentInstance->directory().absolutePath())); + } + + currentInstance = selectInstance(); + if (!currentInstance) { + return 1; + } + } } const QString dataPath = currentInstance->directory().path(); -- cgit v1.3.1