mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-11-30 10:48:15 +08:00
[FIX] fix build failure in windows
This commit is contained in:
parent
c78f1e4789
commit
0400bfef40
@ -21,6 +21,8 @@ package disk
|
||||
import (
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
)
|
||||
|
||||
// disk usage of path/disk
|
||||
@ -30,10 +32,13 @@ func DiskUsage(path string) (disk Status) {
|
||||
lpFreeBytesAvailable := int64(0)
|
||||
lpTotalNumberOfBytes := int64(0)
|
||||
lpTotalNumberOfFreeBytes := int64(0)
|
||||
r2, _, err := c.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr("F:"))),
|
||||
_, _, err := c.Call(uintptr(unsafe.Pointer(syscall.StringToUTF16Ptr(path))),
|
||||
uintptr(unsafe.Pointer(&lpFreeBytesAvailable)),
|
||||
uintptr(unsafe.Pointer(&lpTotalNumberOfBytes)),
|
||||
uintptr(unsafe.Pointer(&lpTotalNumberOfFreeBytes)))
|
||||
if err != nil {
|
||||
logrus.Errorf("read %s disk usage info failure %s", path, err.Error())
|
||||
}
|
||||
disk.All = uint64(lpTotalNumberOfBytes)
|
||||
disk.Free = uint64(lpTotalNumberOfFreeBytes)
|
||||
disk.Used = uint64(lpTotalNumberOfBytes - lpTotalNumberOfFreeBytes)
|
||||
|
Loading…
Reference in New Issue
Block a user