desktop: Handle versions of lsb_release that wrap -s output in quotes
This commit is contained in:
parent
612d0b232f
commit
e43a4a3ebd
1 changed files with 7 additions and 1 deletions
|
@ -152,8 +152,14 @@ std::string os_version()
|
|||
static const std::string cmdline = lsb_release_bin + " -s -d";
|
||||
|
||||
scoped_posix_pipe p(popen(cmdline.c_str(), "r"));
|
||||
const std::string& ver = read_pipe_line(p);
|
||||
std::string ver = read_pipe_line(p);
|
||||
|
||||
if(ver.length() >= 2 && ver[0] == '"' && ver[ver.length() - 1] == '"') {
|
||||
ver.erase(ver.length() - 1, 1);
|
||||
ver.erase(0, 1);
|
||||
}
|
||||
|
||||
// Check this again in case we got "" above for some weird reason.
|
||||
if(!ver.empty()) {
|
||||
return ver;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue