From 722987be3bc30d07d64b97361749ab03a0cc50fb Mon Sep 17 00:00:00 2001 From: rbuj Date: Sun, 17 Mar 2019 18:48:13 +0100 Subject: 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/" --- src/sysinfo.cpp | 20 ++++++++++++++------ 1 file 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); + } } } } -- cgit v1.2.1