summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-03-17 18:48:13 +0100
committerraveit65 <[email protected]>2019-04-15 18:17:51 +0200
commitf5db6d4ed7bca4c7193e7cf136d77ab14731b3aa (patch)
tree842ff467200b27f0ebb6c171726cb574240d356a /src
parent9d971d70d1f5e9bae0ce54146d75c4de1967293c (diff)
downloadmate-system-monitor-f5db6d4ed7bca4c7193e7cf136d77ab14731b3aa.tar.bz2
mate-system-monitor-f5db6d4ed7bca4c7193e7cf136d77ab14731b3aa.tar.xz
Fix openSUSE Tumbleweed rolling release info
$ cat os-release NAME="openSUSE Tumbleweed" ID="opensuse-tumbleweed" ID_LIKE="opensuse suse" VERSION_ID="20190314" PRETTY_NAME="openSUSE Tumbleweed" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:tumbleweed:20190314" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/"
Diffstat (limited to 'src')
-rw-r--r--src/sysinfo.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index bc2f37a..273f2f9 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -532,16 +532,24 @@ namespace {
if (input) {
while (!input.eof()) {
string s;
- int len;
+ int start;
std::getline(input, s);
if (s.find("NAME=") == 0) {
- len = strlen("NAME=");
- this->distro_name = s.substr(len);
+ start = strlen("NAME=");
+ if ((s.at(start) == '\"') && (s.at(s.size() - 1) == '\"')) {
+ this->distro_name = s.substr(start + 1, s.size() - start - 2);
+ } else {
+ this->distro_name = s.substr(start);
+ }
} else if (s.find("VERSION=") == 0) {
- len = strlen("VERSION=");
+ start = strlen("VERSION=");
// also strip the surrounding quotes
- this->distro_release = s.substr(len + 1, s.size() - len - 2);
- }
+ this->distro_release = s.substr(start + 1, s.size() - start - 2);
+ } else if (s.find("# VERSION=") == 0) {
+ start = strlen("# VERSION=");
+ // also strip the surrounding quotes
+ this->distro_release = s.substr(start + 1, s.size() - start - 2);
+ }
}
}
}