fs is dir entry
This commit is contained in:
parent
e576e62599
commit
fd3beea874
12 changed files with 172 additions and 27 deletions
src/host/vfs
|
@ -47,7 +47,7 @@ type ArchiveFS struct {
|
|||
|
||||
r iio.Reader
|
||||
|
||||
size int64
|
||||
Size int64
|
||||
|
||||
files func() (map[string]File, error)
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ func NewArchive(name string, r iio.Reader, size int64, loader archiveLoader) *Ar
|
|||
return &ArchiveFS{
|
||||
name: name,
|
||||
r: r,
|
||||
size: size,
|
||||
Size: size,
|
||||
files: OnceValueWOErr(func() (map[string]File, error) {
|
||||
zipFiles, err := loader(r, size)
|
||||
if err != nil {
|
||||
|
@ -136,6 +136,30 @@ func (afs *ArchiveFS) Stat(filename string) (fs.FileInfo, error) {
|
|||
return nil, ErrNotExist
|
||||
}
|
||||
|
||||
// Info implements Filesystem.
|
||||
func (a *ArchiveFS) Info() (fs.FileInfo, error) {
|
||||
return &fileInfo{
|
||||
name: a.name,
|
||||
size: a.Size,
|
||||
isDir: true,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// IsDir implements Filesystem.
|
||||
func (a *ArchiveFS) IsDir() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// Name implements Filesystem.
|
||||
func (a *ArchiveFS) Name() string {
|
||||
return a.name
|
||||
}
|
||||
|
||||
// Type implements Filesystem.
|
||||
func (a *ArchiveFS) Type() fs.FileMode {
|
||||
return fs.ModeDir
|
||||
}
|
||||
|
||||
var _ File = &archiveFile{}
|
||||
|
||||
func NewArchiveFile(name string, readerFunc func() (iio.Reader, error), size int64) *archiveFile {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue