tstor/src/host/vfs/dir.go

44 lines
558 B
Go
Raw Normal View History

2023-10-16 09:18:40 +00:00
package vfs
2023-12-21 23:15:39 +00:00
import (
"io/fs"
"path"
)
2023-12-21 23:15:39 +00:00
var _ File = &dir{}
func NewDir(name string) File {
return &dir{
name: path.Base(name),
}
}
type dir struct {
name string
}
// Info implements File.
func (d *dir) Stat() (fs.FileInfo, error) {
return newDirInfo(d.name), nil
}
2023-12-21 23:15:39 +00:00
func (d *dir) Size() int64 {
return 0
}
2023-12-21 23:15:39 +00:00
func (d *dir) IsDir() bool {
return true
}
2023-12-21 23:15:39 +00:00
func (d *dir) Close() error {
return nil
}
2023-12-21 23:15:39 +00:00
func (d *dir) Read(p []byte) (n int, err error) {
return 0, nil
}
2023-12-21 23:15:39 +00:00
func (d *dir) ReadAt(p []byte, off int64) (n int, err error) {
return 0, nil
}