From 181acfe832bef26228e33ac3a021d39528b1a4a9 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sun, 17 Jan 2021 18:29:17 -0500 Subject: renamed Refresh to TriggerRefresh, added WaitForRefresh removed duplicate refreshDirectoryStructure() call that could never work added --logs to output logs to stdout, added final "mod organizer done" log added -i with no arguments to output the current instance name `run -e` now does an additional, case insensitive check for names fixed error being output along with --help --- src/main.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index ba808db3..0cd9ba26 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,7 +15,16 @@ using namespace MOBase; thread_local LPTOP_LEVEL_EXCEPTION_FILTER g_prevExceptionFilter = nullptr; thread_local std::terminate_handler g_prevTerminateHandler = nullptr; +int run(int argc, char *argv[]); + int main(int argc, char *argv[]) +{ + const int r = run(argc, argv); + std::cout << "mod organizer done\n"; + return r; +} + +int run(int argc, char *argv[]) { MOShared::SetThisThreadName("main"); setExceptionHandlers(); @@ -34,6 +43,12 @@ int main(int argc, char *argv[]) MOApplication app(argc, argv); + // check if the command line wants to run something right now + if (auto r=cl.runPostApplication(app)) { + return *r; + } + + // check if there's another process running MOMultiProcess multiProcess(cl.multiple()); @@ -95,6 +110,9 @@ int main(int argc, char *argv[]) cl.clear(); continue; + } else if (r != 0) { + // something failed, quit + return r; } } -- cgit v1.3.1