From f00f3203cf1441fcdcc714bf60891cd432413853 Mon Sep 17 00:00:00 2001 From: kaikli <75146125+kaikli@users.noreply.github.com> Date: Sat, 14 Dec 2024 16:28:13 +0100 Subject: [PATCH] fix consistent log directory for linux Signed-off-by: kaikli <75146125+kaikli@users.noreply.github.com> --- src/gui/syncrunfilelog.cpp | 4 ++-- src/libsync/configfile.cpp | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gui/syncrunfilelog.cpp b/src/gui/syncrunfilelog.cpp index 5610fb6a02ff7..d453b6ca2e9c8 100644 --- a/src/gui/syncrunfilelog.cpp +++ b/src/gui/syncrunfilelog.cpp @@ -15,7 +15,7 @@ #include #include "syncrunfilelog.h" -#include "common/utility.h" +#include "libsync/configfile.h" #include "filesystem.h" #include @@ -32,7 +32,7 @@ void SyncRunFileLog::start(const QString &folderPath) { const qint64 logfileMaxSize = 10 * 1024 * 1024; // 10MiB - const QString logpath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); + const QString logpath = ConfigFile().logDir(); if(!QDir(logpath).exists()) { QDir().mkdir(logpath); } diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index 2b1cda432e597..437ab16d056f6 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -1113,7 +1113,10 @@ void ConfigFile::setAutomaticLogDir(bool enabled) QString ConfigFile::logDir() const { - const auto defaultLogDir = QString(configPath() + QStringLiteral("/logs")); + const auto defaultLogDir = QString( + QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + + QStringLiteral("/logs") + ); QSettings settings(configFile(), QSettings::IniFormat); return settings.value(QLatin1String(logDirC), defaultLogDir).toString(); }