返回 DeepSeek-Reasonix
devinfo_linux.go
根目录 / desktop / devinfo_linux.go
1 package main
2
3 import "os"
4
5 func readOr(path string) string {
6 b, err := os.ReadFile(path)
7 if err != nil {
8 return ""
9 }
10 return string(b)
11 }
12
13 func platformOSVersion() string {
14 if name := parseOSReleasePrettyName(readOr("/etc/os-release")); name != "" {
15 return name
16 }
17 return "Linux"
18 }
19
20 func platformCPU() string {
21 return parseCPUModel(readOr("/proc/cpuinfo"))
22 }
23
24 func platformRAMBytes() uint64 {
25 return parseMemTotalBytes(readOr("/proc/meminfo"))
26 }
27
27 lines GO