From 9278985013ce92992b7e3d89eea240af4b72d84e Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Sun, 29 Mar 2026 01:21:57 -0500 Subject: Write logs to instance directory instead of CWD Logs were being created in the current working directory (defaulting to $HOME when launched from a desktop entry). Now uses the instance directory passed to setLogDirectory() so each instance gets its own logs/ folder. Removes unused FLUORINE_LAUNCH_DIR env var. Co-Authored-By: Claude Opus 4.6 (1M context) --- docker/build-inner.sh | 2 -- src/src/loglist.cpp | 17 +++-------------- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/docker/build-inner.sh b/docker/build-inner.sh index e810ad4..fc7ace5 100755 --- a/docker/build-inner.sh +++ b/docker/build-inner.sh @@ -435,7 +435,6 @@ export QT_QPA_PLATFORM_PLUGIN_PATH="${RUN}/qt6plugins/platforms" # can easily exceed the default 1024 ulimit -n 65536 2>/dev/null -export FLUORINE_LAUNCH_DIR="${PWD}" cd "${RUN}" exec "${RUN}/ModOrganizer-core" "$@" LAUNCH @@ -670,7 +669,6 @@ export XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:-KDE}" # can easily exceed the default 1024 ulimit -n 65536 2>/dev/null -export FLUORINE_LAUNCH_DIR="${PWD}" cd "${APPIMAGE_DIR}" exec "${BIN}/ModOrganizer-core" "$@" APPRUN diff --git a/src/src/loglist.cpp b/src/src/loglist.cpp index b7ccda2..cf4b6a7 100644 --- a/src/src/loglist.cpp +++ b/src/src/loglist.cpp @@ -20,10 +20,8 @@ along with Mod Organizer. If not, see . #include "loglist.h" #include "copyeventfilter.h" #include "env.h" -#include "fluorinepaths.h" #include "organizercore.h" #include -#include using namespace MOBase; @@ -242,10 +240,7 @@ void LogList::clear() void LogList::openLogsFolder() { #ifndef _WIN32 - const char* launchDir = std::getenv("FLUORINE_LAUNCH_DIR"); - const QString logsPath = (launchDir && launchDir[0]) - ? QString::fromUtf8(launchDir) + "/logs" - : QDir::currentPath() + "/logs"; + const QString logsPath = qApp->property("dataPath").toString() + "/logs"; #else const QString logsPath = qApp->property("dataPath").toString() + "/" + QString::fromStdWString(AppConfig::logPath()); @@ -410,14 +405,8 @@ bool createAndMakeWritable(const std::wstring& subPath) bool setLogDirectory(const QString& dir) { #ifndef _WIN32 - // Place logs in the directory the user launched fluorine from so they're - // easy to find and share. Each launch creates a new timestamped log file - // and the oldest are cleaned up to keep only the last 5. - // FLUORINE_LAUNCH_DIR is set by the launcher script before it cd's elsewhere. - const char* launchDir = std::getenv("FLUORINE_LAUNCH_DIR"); - const QString logDir = (launchDir && launchDir[0]) - ? QString::fromUtf8(launchDir) + "/logs" - : QDir::currentPath() + "/logs"; + // Place logs in the instance directory so each instance has its own logs. + const QString logDir = dir + "/logs"; QDir().mkpath(logDir); // Create a timestamped log file for this session. -- cgit v1.3.1