summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-08-02 07:01:06 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-08-02 07:01:06 -0400
commit5e98855847590cfff4e04aa7c3d593f0d30e7202 (patch)
tree95918a03c8a6d299c52993baf541004e2d66a4ea /src
parentcff526415d781cb8a7761961ae2bd1fb6775c376 (diff)
create log directory sooner to handle creating new instances
reset the log file in case MO is restarted and the previously selected instance is deleted switched back to single `mo_interface.log` file
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 0e61a781..911f11c3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -120,10 +120,6 @@ bool bootstrap()
removeOldFiles(qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::logPath()),
"usvfs*.log", 5, QDir::Name);
- if (!createAndMakeWritable(AppConfig::logPath())) {
- return false;
- }
-
return true;
}
@@ -906,6 +902,10 @@ int main(int argc, char *argv[])
} // we continue for the primary instance OR if MO was called with parameters
do {
+ // make sure the log file isn't locked in case MO was restarted and
+ // the previous instance gets deleted
+ log::getDefault().setFile({});
+
QString dataPath;
try {
@@ -926,8 +926,12 @@ int main(int argc, char *argv[])
const auto logFile =
qApp->property("dataPath").toString() + "/logs/mo_interface.log";
- log::getDefault().setFile(MOBase::log::File::rotating(
- logFile.toStdWString(), 5*1024*1024, 5));
+ if (!createAndMakeWritable(AppConfig::logPath())) {
+ reportError("Failed to create log folder");
+ return 1;
+ }
+
+ log::getDefault().setFile(MOBase::log::File::single(logFile.toStdWString()));
QString splash = dataPath + "/splash.png";
if (!QFile::exists(dataPath + "/splash.png")) {