summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jrim@rimpo.org>2019-08-02 13:36:32 -0500
committerGitHub <noreply@github.com>2019-08-02 13:36:32 -0500
commit80dd9222f325959a26580ce2fdd1ebc4b7979517 (patch)
tree95918a03c8a6d299c52993baf541004e2d66a4ea /src/main.cpp
parentcff526415d781cb8a7761961ae2bd1fb6775c376 (diff)
parent5e98855847590cfff4e04aa7c3d593f0d30e7202 (diff)
Merge pull request #809 from isanae/logging-fixes
Logging fixes
Diffstat (limited to 'src/main.cpp')
-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")) {