vendor/github.com/spf13/afero/basepath.go
changeset 260 445e01aede7e
parent 256 6d9efbef00a9
--- a/vendor/github.com/spf13/afero/basepath.go	Tue Aug 23 22:33:28 2022 +0200
+++ b/vendor/github.com/spf13/afero/basepath.go	Tue Aug 23 22:39:43 2022 +0200
@@ -1,6 +1,7 @@
 package afero
 
 import (
+	"io/fs"
 	"os"
 	"path/filepath"
 	"runtime"
@@ -8,7 +9,10 @@
 	"time"
 )
 
-var _ Lstater = (*BasePathFs)(nil)
+var (
+	_ Lstater        = (*BasePathFs)(nil)
+	_ fs.ReadDirFile = (*BasePathFile)(nil)
+)
 
 // The BasePathFs restricts all operations to a given path within an Fs.
 // The given file name to the operations on this Fs will be prepended with
@@ -33,6 +37,14 @@
 	return strings.TrimPrefix(sourcename, filepath.Clean(f.path))
 }
 
+func (f *BasePathFile) ReadDir(n int) ([]fs.DirEntry, error) {
+	if rdf, ok := f.File.(fs.ReadDirFile); ok {
+		return rdf.ReadDir(n)
+
+	}
+	return readDirFile{f.File}.ReadDir(n)
+}
+
 func NewBasePathFs(source Fs, path string) Fs {
 	return &BasePathFs{source: source, path: path}
 }