Fixed windows compatibility
Some checks failed
Run Integration Tests / test (push) Failing after 10m8s
Some checks failed
Run Integration Tests / test (push) Failing after 10m8s
This commit is contained in:
parent
ed588e8764
commit
8dbfaae1b6
4 changed files with 64 additions and 23 deletions
27
disk.go
Normal file
27
disk.go
Normal file
|
@ -0,0 +1,27 @@
|
|||
//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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue