Skip to content

Commit

Permalink
fix consistent log directory for linux
Browse files Browse the repository at this point in the history
Signed-off-by: kaikli <75146125+kaikli@users.noreply.github.com>
  • Loading branch information
kaikli committed Dec 16, 2024
1 parent 389983d commit f00f320
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/gui/syncrunfilelog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <QRegularExpression>

#include "syncrunfilelog.h"
#include "common/utility.h"
#include "libsync/configfile.h"
#include "filesystem.h"
#include <qfileinfo.h>

Expand All @@ -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);
}
Expand Down
5 changes: 4 additions & 1 deletion src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit f00f320

Please sign in to comment.