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
23
config.go
23
config.go
|
@ -4,10 +4,8 @@ import (
|
|||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/shirou/gopsutil/mem"
|
||||
|
@ -537,27 +535,6 @@ func parseMaxUsageDrive(value string, cachePath string) uint64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
// Get total disk space of the system where cachePath resides
|
||||
func getTotalDiskSpace(cachePath string) uint64 {
|
||||
var stat syscall.Statfs_t
|
||||
|
||||
// Get filesystem stats for the cache path
|
||||
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
|
||||
}
|
||||
|
||||
// Total disk space in bytes
|
||||
return stat.Blocks * uint64(stat.Bsize)
|
||||
}
|
||||
|
||||
// Helper to format bytes back to human-readable string
|
||||
func formatMaxUsage(bytes uint64) string {
|
||||
const GiB = 1024 * 1024 * 1024
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue