mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-08 13:51:43 +02:00
Cache getOS result
This commit is contained in:
parent
dac7c8f4f7
commit
a8d1769ca7
1 changed files with 7 additions and 2 deletions
|
@ -90,7 +90,11 @@ static std::string getProp(const std::string& key, const std::string& def = "")
|
|||
|
||||
static std::string getOS()
|
||||
{
|
||||
std::string os;
|
||||
static std::string os("");
|
||||
|
||||
if (!os.empty())
|
||||
return os;
|
||||
|
||||
#ifdef ANDROID
|
||||
os = strutils::trim_copy("Android " + getProp("ro.build.version.release"));
|
||||
#else
|
||||
|
@ -114,7 +118,8 @@ static std::string getOS()
|
|||
uname(&u);
|
||||
os = u.sysname;
|
||||
}
|
||||
return strutils::trim_copy(os);
|
||||
strutils::trim(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue