1/*
2 SPDX-FileCopyrightText: 2016-2021 Harald Sitter <sitter@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "coreconfig_p.h"
8
9#include <QFile>
10
11#include <config-kcrash.h>
12namespace KCrash
13{
14CoreConfig::CoreConfig(const QString &path)
15{
16#if !KCRASH_CORE_PATTERN_RAISE
17 return; // Leave everything false unless enabled.
18#endif
19 QFile file(path);
20 if (!file.open(flags: QIODevice::ReadOnly | QIODevice::Text)) {
21 return;
22 }
23 char first = 0;
24 if (!file.getChar(c: &first)) {
25 return;
26 }
27 m_supported = true;
28 m_process = first == '|';
29
30 if (file.readLine().contains(QByteArrayLiteral("systemd-coredump"))) {
31 m_coredumpd = true;
32 }
33}
34
35bool CoreConfig::isProcess() const
36{
37 return m_supported && m_process;
38}
39
40bool CoreConfig::isCoredumpd() const
41{
42 return m_coredumpd;
43}
44
45} // namespace KCrash
46

source code of kcrash/src/coreconfig.cpp