summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/os_linuxbsd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/linuxbsd/os_linuxbsd.cpp')
-rw-r--r--platform/linuxbsd/os_linuxbsd.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/linuxbsd/os_linuxbsd.cpp b/platform/linuxbsd/os_linuxbsd.cpp
index e95a865636..5e8656c79f 100644
--- a/platform/linuxbsd/os_linuxbsd.cpp
+++ b/platform/linuxbsd/os_linuxbsd.cpp
@@ -141,6 +141,20 @@ String OS_LinuxBSD::get_unique_id() const {
return machine_id;
}
+String OS_LinuxBSD::get_processor_name() const {
+ FileAccessRef f = FileAccess::open("/proc/cpuinfo", FileAccess::READ);
+ ERR_FAIL_COND_V_MSG(!f, "", String("Couldn't open `/proc/cpuinfo` to get the CPU model name. Returning an empty string."));
+
+ while (!f->eof_reached()) {
+ const String line = f->get_line();
+ if (line.find("model name") != -1) {
+ return line.split(":")[1].strip_edges();
+ }
+ }
+
+ ERR_FAIL_V_MSG("", String("Couldn't get the CPU model name from `/proc/cpuinfo`. Returning an empty string."));
+}
+
void OS_LinuxBSD::finalize() {
if (main_loop) {
memdelete(main_loop);