22 lines
479 B
Go
22 lines
479 B
Go
//go:build windows
|
|
|
|
package backup
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
func restoreFreeBytes(target string) (uint64, error) {
|
|
path, err := windows.UTF16PtrFromString(target)
|
|
if err != nil {
|
|
return 0, errors.New("restore filesystem capacity is unavailable")
|
|
}
|
|
var available uint64
|
|
if err := windows.GetDiskFreeSpaceEx(path, &available, nil, nil); err != nil {
|
|
return 0, errors.New("restore filesystem capacity is unavailable")
|
|
}
|
|
return available, nil
|
|
}
|