summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 55fedc7a..40512006 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -32,6 +32,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "env.h"
#include "envmodule.h"
#include "commandline.h"
+#include "sanitychecks.h"
#include "shared/util.h"
#include "shared/appconfig.h"
#include "shared/error_report.h"
@@ -41,14 +42,9 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include <log.h>
#include <utility.h>
-
using namespace MOBase;
using namespace MOShared;
-void sanityChecks(const env::Environment& env);
-int checkIncompatibleModule(const env::Module& m);
-int checkPathsForSanity(MOBase::IPluginGame& game, const Settings& s);
-
void purgeOldFiles()
{
// remove the temporary backup directory in case we're restarting after an
@@ -159,11 +155,11 @@ int runApplication(
env::Environment env;
env.dump(settings);
settings.dump();
- sanityChecks(env);
+ sanity::checkEnvironment(env);
const auto moduleNotification = env.onModuleLoaded(qApp, [](auto&& m) {
log::debug("loaded module {}", m.toString());
- checkIncompatibleModule(m);
+ sanity::checkIncompatibleModule(m);
});
// this must outlive `organizer`
@@ -204,7 +200,7 @@ int runApplication(
log::debug("this is a portable instance");
}
- checkPathsForSanity(*currentInstance.gamePlugin(), settings);
+ sanity::checkPaths(*currentInstance.gamePlugin(), settings);
organizer.setManagedGame(currentInstance.gamePlugin());
organizer.createDefaultProfile();
@@ -249,10 +245,14 @@ int runApplication(
int res = 1;
- { // scope to control lifetime of mainwindow
+ {
+ // scope to control lifetime of mainwindow
// set up main window and its data structures
MainWindow mainWindow(settings, organizer, *pluginContainer);
+ // qt resets the thread name somewhere when creating the main window
+ MOShared::SetThisThreadName("main");
+
ni.getAccessManager()->setTopLevelWidget(&mainWindow);
QObject::connect(&mainWindow, SIGNAL(styleChanged(QString)), &application,
@@ -373,6 +373,8 @@ int doOneRun(
int main(int argc, char *argv[])
{
+ MOShared::SetThisThreadName("main");
+
cl::CommandLine cl;
if (auto r=cl.run(GetCommandLineW())) {
@@ -381,8 +383,6 @@ int main(int argc, char *argv[])
TimeThis tt("main() to doOneRun()");
- SetThisThreadName("main");
-
initLogging();
auto application = MOApplication::create(argc, argv);