github.com/wasilibs/wazerox@v0.0.0-20240124024944-4923be63ab5f/sys/stat_windows.go (about)

     1  //go:build (amd64 || arm64) && windows
     2  
     3  package sys
     4  
     5  import (
     6  	"io/fs"
     7  	"syscall"
     8  )
     9  
    10  const sysParseable = true
    11  
    12  func statFromFileInfo(info fs.FileInfo) Stat_t {
    13  	if d, ok := info.Sys().(*syscall.Win32FileAttributeData); ok {
    14  		st := Stat_t{}
    15  		st.Ino = 0 // not in Win32FileAttributeData
    16  		st.Dev = 0 // not in Win32FileAttributeData
    17  		st.Mode = info.Mode()
    18  		st.Nlink = 1 // not in Win32FileAttributeData
    19  		st.Size = info.Size()
    20  		st.Atim = d.LastAccessTime.Nanoseconds()
    21  		st.Mtim = d.LastWriteTime.Nanoseconds()
    22  		st.Ctim = d.CreationTime.Nanoseconds()
    23  		return st
    24  	}
    25  	return defaultStatFromFileInfo(info)
    26  }