feat(daemon): validate config file existence before applying watchdog command
This commit is contained in:
parent
5c480ca515
commit
d553946cef
1 changed files with 6 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
#include <QFileInfo>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
using namespace deskflow::core;
|
using namespace deskflow::core;
|
||||||
|
|
@ -61,6 +62,11 @@ void DaemonApp::applyWatchdogCommand() const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!QFileInfo::exists(m_configFile)) {
|
||||||
|
LOG_ERR("cannot apply watchdog command: config file does not exist: %s", qPrintable(m_configFile));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QSettings config(m_configFile, QSettings::IniFormat);
|
QSettings config(m_configFile, QSettings::IniFormat);
|
||||||
const auto coreMode = config.value(Settings::Core::CoreMode).toInt();
|
const auto coreMode = config.value(Settings::Core::CoreMode).toInt();
|
||||||
const auto elevate = config.value(Settings::Daemon::Elevate, !Settings::isPortableMode()).toBool();
|
const auto elevate = config.value(Settings::Daemon::Elevate, !Settings::isPortableMode()).toBool();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue