Skip to content

Commit

Permalink
🧹 implement missing Readdir for catfs (#4206)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-rock authored Jun 7, 2024
1 parent 9c024b3 commit 465329a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion providers/os/connection/ssh/cat/cat_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,20 @@ func (f *File) ReadAt(b []byte, off int64) (n int, err error) {
}

func (f *File) Readdir(count int) (res []os.FileInfo, err error) {
return nil, errors.New("not implemented")
names, err := f.Readdirnames(count)
if err != nil {
return nil, err
}

res = make([]os.FileInfo, len(names))
for i, name := range names {
res[i], err = f.catfs.Stat(name)
if err != nil {
return nil, err
}
}

return res, nil
}

func (f *File) Readdirnames(n int) (names []string, err error) {
Expand Down

0 comments on commit 465329a

Please sign in to comment.