fix for overview panel
This commit is contained in:
parent
21d8e91756
commit
d16f34070d
21 changed files with 920 additions and 40 deletions
20
internal/hoststats/disk_windows.go
Normal file
20
internal/hoststats/disk_windows.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//go:build windows
|
||||
|
||||
package hoststats
|
||||
|
||||
import "golang.org/x/sys/windows"
|
||||
|
||||
// diskFreeBytes returns free (available to the calling user) and total
|
||||
// bytes for the volume containing path. Mirrors
|
||||
// internal/app/files/diskspace_windows.go's localDiskFreeBytes.
|
||||
func diskFreeBytes(path string) (free, total int64, err error) {
|
||||
ptr, err := windows.UTF16PtrFromString(path)
|
||||
if err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
var freeAvail, totalBytes, totalFree uint64
|
||||
if err := windows.GetDiskFreeSpaceEx(ptr, &freeAvail, &totalBytes, &totalFree); err != nil {
|
||||
return 0, 0, err
|
||||
}
|
||||
return int64(freeAvail), int64(totalBytes), nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue