Search/disk.go
partisan 8dbfaae1b6
Some checks failed
Run Integration Tests / test (push) Failing after 10m8s
Fixed windows compatibility
2025-05-31 21:44:31 +02:00

27 lines
490 B
Go

//go:build !windows
// +build !windows
package main
import (
"path/filepath"
"syscall"
)
func getTotalDiskSpace(cachePath string) uint64 {
var stat syscall.Statfs_t
absPath, err := filepath.Abs(cachePath)
if err != nil {
printErr("Failed to resolve absolute path for: %s", cachePath)
return 0
}
err = syscall.Statfs(absPath, &stat)
if err != nil {
printErr("Failed to retrieve filesystem stats for: %s", absPath)
return 0
}
return stat.Blocks * uint64(stat.Bsize)
}