-
Notifications
You must be signed in to change notification settings - Fork 0
/
info.go
53 lines (43 loc) · 782 Bytes
/
info.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
package jsonfs
import (
"io/fs"
pathpkg "path"
"time"
)
type fileInfo struct {
isDir bool
path string
size int64
}
func (info *fileInfo) Name() string {
return pathpkg.Base(info.path)
}
func (info *fileInfo) Size() int64 {
return info.size
}
func (info *fileInfo) Mode() fs.FileMode {
const rdonly = 0444
const exonly = 0111
if info.isDir {
return rdonly | exonly | fs.ModeDir
}
return rdonly
}
func (info *fileInfo) Type() fs.FileMode {
if info.isDir {
return fs.ModeDir
}
return 0
}
func (info *fileInfo) ModTime() time.Time {
return time.Time{}
}
func (info *fileInfo) IsDir() bool {
return info.isDir
}
func (info *fileInfo) Info() (fs.FileInfo, error) {
return fs.FileInfo(info), nil
}
func (info *fileInfo) Sys() interface{} {
return nil
}