Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,12 @@ func CapabilityCheck(fs Basic, capabilities Capability) bool {
fsCaps := Capabilities(fs)
return fsCaps&capabilities == capabilities
}

// Stat returns the os.FileInfo structure describing file.
func Stat(f File) (os.FileInfo, error) {
fi, ok := f.(interface{ Stat() (os.FileInfo, error) })
if !ok {
return nil, ErrNotSupported
}
return fi.Stat()
}
18 changes: 18 additions & 0 deletions helper/chroot/chroot.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ func (fs *ChrootHelper) Capabilities() billy.Capability {
return billy.Capabilities(fs.underlying)
}

type fileInfo struct {
os.FileInfo
name string
}

func (fi *fileInfo) Name() string {
return fi.name
}

type file struct {
billy.File
name string
Expand All @@ -240,3 +249,12 @@ func newFile(fs billy.Filesystem, f billy.File, filename string) billy.File {
func (f *file) Name() string {
return f.name
}

func (f *file) Stat() (os.FileInfo, error) {
fi, err := billy.Stat(f.File)
if err != nil {
return fi, err
}
name := f.Name()
return &fileInfo{fi, name}, nil
}