Merge pull request #3963 from natasha41575/KustomizeEditFix

small `api` changes for kustomize fix
This commit is contained in:
Jeff Regan
2021-06-08 13:52:06 -07:00
committed by GitHub
5 changed files with 53 additions and 11 deletions

View File

@@ -349,6 +349,29 @@ func (n *fsNode) IsDir(path string) bool {
return result.isNodeADir()
}
// ReadDir implements FileSystem.
func (n *fsNode) ReadDir(path string) ([]string, error) {
if !n.IsDir(path) {
return nil, fmt.Errorf("%s is not a directory", path)
}
dir, err := n.Find(path)
if err != nil {
return nil, err
}
if dir == nil {
return nil, fmt.Errorf("could not find directory %s", path)
}
keys := make([]string, len(dir.dir))
i := 0
for k := range dir.dir {
keys[i] = k
i++
}
return keys, nil
}
// Size returns the size of the node.
func (n *fsNode) Size() int64 {
if n.isNodeADir() {