Browse Source

Better device type detection on linux.

tags/2021-05-28
jules 11 years ago
parent
commit
d2ed531ab8
1 changed files with 12 additions and 7 deletions
  1. +12
    -7
      modules/juce_core/native/juce_linux_SystemStats.cpp

+ 12
- 7
modules/juce_core/native/juce_linux_SystemStats.cpp View File

@@ -42,11 +42,6 @@ String SystemStats::getOperatingSystemName()
return "Linux";
}
String SystemStats::getDeviceDescription()
{
return String();
}
bool SystemStats::isOperatingSystem64Bit()
{
#if JUCE_64BIT
@@ -66,16 +61,26 @@ namespace LinuxStatsHelpers
File ("/proc/cpuinfo").readLines (lines);
for (int i = lines.size(); --i >= 0;) // (NB - it's important that this runs in reverse order)
if (lines[i].startsWithIgnoreCase (key))
if (lines[i].upToFirstOccurrenceOf (":", false, false).trim().equalsIgnoreCase (key))
return lines[i].fromFirstOccurrenceOf (":", false, false).trim();
return String();
}
}
String SystemStats::getDeviceDescription()
{
return LinuxStatsHelpers::getCpuInfo ("Hardware");
}
String SystemStats::getCpuVendor()
{
return LinuxStatsHelpers::getCpuInfo ("vendor_id");
String v (LinuxStatsHelpers::getCpuInfo ("vendor_id"));
if (v.isEmpty())
v = LinuxStatsHelpers::getCpuInfo ("model name");
return v;
}
int SystemStats::getCpuSpeedInMegaherz()


Loading…
Cancel
Save