From bcd5b5a981dd0bf032ad742e4f90931bfd447a03 Mon Sep 17 00:00:00 2001 From: fmckenna Date: Mon, 18 Apr 2022 11:21:00 -0700 Subject: [PATCH] fmk - using a user defined SIMCENTER_WORKDIR env variable to override debug.log location --- main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index f1c11fe5..5f26ead2 100644 --- a/main.cpp +++ b/main.cpp @@ -44,6 +44,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS. #include #include #include +#include #include #include @@ -105,12 +106,17 @@ int main(int argc, char *argv[]) // set up logging of output messages for user debugging // - logFilePath = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + QDir::separator() + QCoreApplication::applicationName() + QDir::separator() + QString("debug.log"); + QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); + QString workDir = env.value("SIMCENTER_WORKDIR","None"); + if (workDir != "None") { + logFilePath = workDir + QDir::separator() + QString("debug.log"); + } + // remove old log file QFile debugFile(logFilePath); debugFile.remove();