-
Notifications
You must be signed in to change notification settings - Fork 9
/
api_windows.go
37 lines (29 loc) · 1.04 KB
/
api_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// +build windows
package lfs
import (
"os"
"syscall"
"time"
"github.com/yuin/gopher-lua"
)
func attributesFill(tbl *lua.LTable, stat os.FileInfo) error {
sys := stat.Sys().(*syscall.Win32FileAttributeData)
tbl.RawSetString("dev", lua.LNumber(0))
tbl.RawSetString("ino", lua.LNumber(0))
if stat.IsDir() {
tbl.RawSetString("mode", lua.LString("directory"))
} else {
tbl.RawSetString("mode", lua.LString("file"))
}
tbl.RawSetString("nlink", lua.LNumber(0))
tbl.RawSetString("uid", lua.LNumber(0))
tbl.RawSetString("gid", lua.LNumber(0))
tbl.RawSetString("rdev", lua.LNumber(0))
tbl.RawSetString("access", lua.LNumber(time.Unix(0, sys.LastAccessTime.Nanoseconds()/1e9).Second()))
tbl.RawSetString("modification", lua.LNumber(time.Unix(0, sys.CreationTime.Nanoseconds()/1e9).Second()))
tbl.RawSetString("change", lua.LNumber(time.Unix(0, sys.LastWriteTime.Nanoseconds()/1e9).Second()))
tbl.RawSetString("size", lua.LNumber(stat.Size()))
tbl.RawSetString("blocks", lua.LNumber(0))
tbl.RawSetString("blksize", lua.LNumber(0))
return nil
}