-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfsinfo_other.go
55 lines (39 loc) · 1.47 KB
/
fsinfo_other.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//go:build !darwin && !linux
package fsinfo
import (
"fmt"
"io/fs"
"time"
)
func newFileInfo(name string, mode fs.FileMode, modTime time.Time, size int64, sys any) *fileInfo {
return &fileInfo{name, mode, modTime, size, sys}
}
type fileInfo struct {
name string
mode fs.FileMode
modTime time.Time
size int64
sys any
}
func (info *fileInfo) String() string {
mode := info.Mode()
size := info.Size()
mtime := info.ModTime().Format("Jan _2 15:04")
return fmt.Sprintf("%s 1 %d %s %s", mode, size, mtime, info.name)
}
func (info *fileInfo) Name() string { return info.name }
func (info *fileInfo) Mode() fs.FileMode { return info.mode }
func (info *fileInfo) ModTime() time.Time { return info.modTime }
func (info *fileInfo) IsDir() bool { return info.mode.IsDir() }
func (info *fileInfo) Size() int64 { return info.size }
func (info *fileInfo) Sys() any { return info.sys }
func makeMode(mode fs.FileMode) uint32 { return uint32(mode.Perm()) }
func mode(info fs.FileInfo) uint32 { return FileMode(info.Mode()) }
func uid(info fs.FileInfo) uint32 { return 0 }
func gid(info fs.FileInfo) uint32 { return 0 }
func ino(info fs.FileInfo) uint64 { return 0 }
func nlink(info fs.FileInfo) uint64 { return 1 }
func device(info fs.FileInfo) uint64 { return 0 }
func mtime(info fs.FileInfo) time.Time { return info.ModTime() }
func atime(info fs.FileInfo) time.Time { return time.Time{} }
func ctime(info fs.FileInfo) time.Time { return time.Time{} }