[gnome-system-monitor] Also strip doublequotes from os-release name attribute, if there are any



commit 855b8d5ce99680ac680b550adc522b4bc34e9e00
Author: Robert Roth <robert roth off gmail com>
Date:   Thu Nov 29 23:33:31 2012 +0200

    Also strip doublequotes from os-release name attribute, if there are any

 src/sysinfo.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/sysinfo.cpp b/src/sysinfo.cpp
index fd2cf66..ee96f55 100644
--- a/src/sysinfo.cpp
+++ b/src/sysinfo.cpp
@@ -557,7 +557,11 @@ namespace {
                     std::getline(input, s);
                     if (s.find("NAME=") == 0) {
                         len = strlen("NAME=");
-                        this->distro_name = s.substr(len);
+                        string name = s.substr(len);
+                        if (!name.empty() && name[0] == '"' && name[name.size() - 1] == '"')  {
+                            name = name.substr(1, name.size()-2);
+                        }
+                        this->distro_name = name;
                     } else if (s.find("VERSION=") == 0) {
                         len = strlen("VERSION=");
                         // also strip the surrounding quotes



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]