refactor: Coreprocess remove single use one liner persistLogDir, make dir in start if needed

This commit is contained in:
sithlord48
2025-10-10 16:31:28 -04:00
committed by Chris Rizzitello
parent 13990438d3
commit 004089f887
2 changed files with 3 additions and 7 deletions

View File

@ -1,5 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-FileCopyrightText: (C) 2024 - 2025 Symless Ltd.
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
@ -347,8 +348,8 @@ void CoreProcess::start(std::optional<ProcessMode> processModeOption)
qDebug().noquote() << "log level:" << Settings::logLevelText();
if (Settings::value(Settings::Log::ToFile).toBool()) {
persistLogDir();
const auto logFile = Settings::value(Settings::Log::File).toString();
QDir(QFileInfo(logFile).absolutePath()).mkpath(".");
args.append({QStringLiteral("--log"), logFile});
qInfo().noquote() << "log file:" << logFile;
}
@ -550,11 +551,6 @@ QString CoreProcess::requestDaemonLogPath()
return logPath;
}
void CoreProcess::persistLogDir() const
{
QDir(QFileInfo(Settings::value(Settings::Log::File).toString()).absolutePath()).mkpath(".");
}
void CoreProcess::clearSettings()
{
const auto processMode = Settings::value(Settings::Core::ProcessMode).value<ProcessMode>();

View File

@ -1,5 +1,6 @@
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2025 Chris Rizzitello <sithlord48@gmail.com>
* SPDX-FileCopyrightText: (C) 2024 - 2025 Symless Ltd.
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
*/
@ -125,7 +126,6 @@ private:
void handleLogLines(const QString &text);
QString correctedAddress() const;
QString requestDaemonLogPath();
void persistLogDir() const;
static QString makeQuotedArgs(const QString &app, const QStringList &args);
static QString processModeToString(const Settings::ProcessMode mode);
static QString processStateToString(const CoreProcess::ProcessState state);