Beispiel #1
0
CStdString CSysInfo::GetUnameVersion()
{
  CStdString result = "";

#if defined(TARGET_ANDROID)
  struct utsname name;
  if (uname(&name) == -1)
    result = "Android";
  result += name.release;
  result += " ";
  result += name.machine;
#else
  FILE* pipe = popen("uname -rm", "r");
  if (pipe)
  {
    char buffer[256] = {'\0'};
    if (fread(buffer, sizeof(char), sizeof(buffer), pipe) > 0 && !ferror(pipe))
    {
      result = buffer;
#if defined(TARGET_DARWIN)
      result.Trim();
      result += ", "; 
      result += GetDarwinVersionString();
#endif
    }
    else
      CLog::Log(LOGWARNING, "Unable to determine Uname version");
    pclose(pipe);
  }
#endif//else !TARGET_ANDROID

  return result.Trim();
}
Beispiel #2
0
CStdString CSysInfo::GetUnameVersion()
{
  CStdString result = "";

  FILE* pipe = popen("uname -rm", "r");
  if (pipe)
  {
    char buffer[256] = {'\0'};
    if (fread(buffer, sizeof(char), sizeof(buffer), pipe) > 0 && !ferror(pipe))
    {
      result = buffer;
#if defined(TARGET_DARWIN)
      result.Trim();
      result += ", "; 
      result += GetDarwinVersionString();
#endif
    }
    else
      CLog::Log(LOGWARNING, "Unable to determine Uname version");
    pclose(pipe);
  }

  return result.Trim();
}