github.com/rclone/rclone@v1.66.1-0.20240517100346-7b89735ae726/lib/diskusage/diskusage_windows.go (about)

     1  //go:build windows
     2  
     3  package diskusage
     4  
     5  import (
     6  	"golang.org/x/sys/windows"
     7  )
     8  
     9  // New returns the disk status for dir.
    10  //
    11  // May return Unsupported error if it doesn't work on this platform.
    12  func New(dir string) (info Info, err error) {
    13  	dir16 := windows.StringToUTF16Ptr(dir)
    14  	err = windows.GetDiskFreeSpaceEx(dir16, &info.Available, &info.Total, &info.Free)
    15  	return info, err
    16  }