updated memory calculation and logo

This commit is contained in:
2026-02-14 12:41:08 +01:00
parent 6a7737ee1c
commit 44a7d0de2c
10 changed files with 365 additions and 47 deletions
+11
View File
@@ -4,6 +4,7 @@ package system
import (
"bufio"
"fmt"
"os"
"strings"
"syscall"
@@ -29,6 +30,16 @@ func GetInfo(hddPath string) SystemInfo {
return info
}
// GetTotalMemoryMB reads total system memory from /proc/meminfo.
func GetTotalMemoryMB() (int, error) {
info := SystemInfo{}
readMemInfo(&info)
if info.TotalMemMB == 0 {
return 0, fmt.Errorf("could not read MemTotal from /proc/meminfo")
}
return int(info.TotalMemMB), nil
}
func readMemInfo(info *SystemInfo) {
f, err := os.Open("/proc/meminfo")
if err != nil {
+7
View File
@@ -2,7 +2,14 @@
package system
import "fmt"
// GetInfo returns empty system info on non-Linux platforms.
func GetInfo(_ string) SystemInfo {
return SystemInfo{}
}
// GetTotalMemoryMB is not available on non-Linux platforms.
func GetTotalMemoryMB() (int, error) {
return 0, fmt.Errorf("/proc/meminfo not available on this platform")
}