summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f85e13f3..adb33d91 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -37,12 +37,27 @@ int main(int argc, char *argv[])
MOMultiProcess multiProcess(cl.multiple());
if (multiProcess.ephemeral()) {
- return forwardToPrimary(multiProcess, cl);
+ if (cl.forwardToPrimary(multiProcess)) {
+ return 0;
+ } else {
+ QMessageBox::information(
+ nullptr, QObject::tr("Mod Organizer"),
+ QObject::tr("An instance of Mod Organizer is already running"));
+ }
+
+ return 0;
+ }
+
+ if (auto r=cl.runPostMultiProcess(multiProcess)) {
+ return *r;
}
tt.stop();
+ app.firstTimeSetup(multiProcess);
+
+
// MO runs in a loop because it can be restarted in several ways, such as
// when switching instances or changing some settings
for (;;)
@@ -73,7 +88,7 @@ int main(int argc, char *argv[])
}
}
- if (auto r=cl.run(app.core())) {
+ if (auto r=cl.runPostOrganizer(app.core())) {
return *r;
}
@@ -99,21 +114,6 @@ int main(int argc, char *argv[])
}
}
-int forwardToPrimary(MOMultiProcess& multiProcess, const cl::CommandLine& cl)
-{
- if (cl.shortcut().isValid()) {
- multiProcess.sendMessage(cl.shortcut().toString());
- } else if (cl.nxmLink()) {
- multiProcess.sendMessage(*cl.nxmLink());
- } else {
- QMessageBox::information(
- nullptr, QObject::tr("Mod Organizer"),
- QObject::tr("An instance of Mod Organizer is already running"));
- }
-
- return 0;
-}
-
LONG WINAPI onUnhandledException(_EXCEPTION_POINTERS* ptrs)
{
const auto path = OrganizerCore::getGlobalCoreDumpPath();