Changeset View
Changeset View
Standalone View
Standalone View
libdiscover/backends/PackageKitBackend/PackageKitBackend.cpp
Context not available. | |||||
38 | #include <QDebug> | 38 | #include <QDebug> | ||
---|---|---|---|---|---|
39 | #include <QTimer> | 39 | #include <QTimer> | ||
40 | #include <QStandardPaths> | 40 | #include <QStandardPaths> | ||
41 | #include <QFile> | ||||
41 | 42 | | |||
42 | #include <PackageKit/Transaction> | 43 | #include <PackageKit/Transaction> | ||
43 | #include <PackageKit/Daemon> | 44 | #include <PackageKit/Daemon> | ||
Context not available. | |||||
564 | 565 | | |||
565 | static QString readDistroName() | 566 | static QString readDistroName() | ||
566 | { | 567 | { | ||
568 | const QStringList osreleasenames = (QStringList() << QStringLiteral("/etc/os-release") | ||||
569 | << QStringLiteral("/usr/lib/os-release")); | ||||
570 | foreach (QString osrelease, osreleasenames) | ||||
571 | { | ||||
572 | QFile file(osrelease); | ||||
573 | if (file.open(QIODevice::ReadOnly | QIODevice::Text)) | ||||
574 | { | ||||
575 | QByteArray line; | ||||
576 | while (!file.atEnd()) { | ||||
577 | line = file.readLine().trimmed(); | ||||
578 | if (line.startsWith("NAME=")) { | ||||
579 | auto output = line.right(line.length()-5); | ||||
580 | output = output.replace('\"',""); | ||||
581 | return QString::fromLocal8Bit(output); | ||||
582 | } | ||||
583 | } | ||||
584 | } | ||||
585 | } | ||||
586 | | ||||
567 | QProcess process; | 587 | QProcess process; | ||
568 | process.setEnvironment({QStringLiteral("LC_ALL=C")}); | 588 | process.setEnvironment({QStringLiteral("LC_ALL=C")}); | ||
569 | process.start(QStringLiteral("lsb_release"), {QStringLiteral("-sd")}); | 589 | process.start(QStringLiteral("lsb_release"), {QStringLiteral("-sd")}); | ||
Context not available. |