Files
ttstd-infinite-canvas/backend/internal/app/system_metrics_windows.go
Codex 6abaa7b45a feat(image): integrate PoloX image editing workflows
Add WaveSpeed image editing and image tools plugins, canvas image editing workflows, layer selection, and Cloud Agent image tools with approval-safe transient references.
2026-09-18 20:34:28 +08:00

43 lines
910 B
Go

//go:build windows
package app
import (
"path/filepath"
"golang.org/x/sys/windows"
)
func platformMemory() (uint64, uint64, bool) { return 0, 0, false }
func platformLoadAverage() ([3]float64, bool) { return [3]float64{}, false }
func collectSystemDisk(path string) SystemPerformanceDisk {
if path == "" {
path = "."
}
path, _ = filepath.Abs(path)
directory, err := windows.UTF16PtrFromString(path)
if err != nil {
return SystemPerformanceDisk{}
}
var free, total, totalFree uint64
if err := windows.GetDiskFreeSpaceEx(directory, &free, &total, &totalFree); err != nil {
return SystemPerformanceDisk{}
}
usage := float64(0)
if total > 0 {
usage = float64(total-totalFree) / float64(total) * 100
}
return SystemPerformanceDisk{
Available: true,
Writable: true,
TotalBytes: total,
UsedBytes: total - totalFree,
FreeBytes: free,
UsagePercent: usage,
}
}