//go:build windows package monitor import ( "os" "path/filepath" "golang.org/x/sys/windows" ) func getDiskSpaceGB() (float64, float64) { wd, err := os.Getwd() if err != nil { return 0, 0 } vol := filepath.VolumeName(wd) if vol == "" { return 0, 0 } root := vol + `\\` pathPtr, err := windows.UTF16PtrFromString(root) if err != nil { return 0, 0 } var freeBytesAvailable uint64 var totalBytes uint64 var totalFreeBytes uint64 if err := windows.GetDiskFreeSpaceEx(pathPtr, &freeBytesAvailable, &totalBytes, &totalFreeBytes); err != nil { return 0, 0 } const gb = 1024.0 * 1024.0 * 1024.0 return float64(totalBytes) / gb, float64(totalFreeBytes) / gb }