summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrbuj <[email protected]>2019-03-17 18:48:13 +0100
committerraveit65 <[email protected]>2019-03-17 20:29:15 +0100
commit722987be3bc30d07d64b97361749ab03a0cc50fb (patch)
treeba2f55ec4292f79b2fddac46189a9b2470bf5f7a /src
parent72f34fba6e119843e224f6f42e3d6db26c564ee4 (diff)
downloadmate-system-monitor-722987be3bc30d07d64b97361749ab03a0cc50fb.tar.bz2
mate-system-monitor-722987be3bc30d07d64b97361749ab03a0cc50fb.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);
+ }
}
}
}