summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2020-11-04 20:57:50 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2020-11-04 20:57:50 -0500
commite6a87a17987de5d8e462634777df31e2cae5c1a6 (patch)
tree1d5fa9752f6949b62aa6a8148b07cea7b02d964c /src/main.cpp
parentf7b097e6ba3160b424204c719b615954601f76fe (diff)
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
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp37
1 files changed, 30 insertions, 7 deletions
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<int> handleCommandLine(
return {};
}
-void openInstanceManager(PluginContainer& pc, QWidget* parent);
-
std::optional<Instance> 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<Instance> 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();