Skip to content

Commit 9c94322

Browse files
committed
Simplified ReadDirRecursive method
1 parent ad09f55 commit 9c94322

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

Diff for: readdir.go

+1-21
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,7 @@ func (p *Path) ReadDir(filters ...ReadDirFilter) (PathList, error) {
6969
// ReadDirRecursive returns a PathList containing the content of the directory
7070
// and its subdirectories pointed by the current Path
7171
func (p *Path) ReadDirRecursive() (PathList, error) {
72-
infos, err := os.ReadDir(p.path)
73-
if err != nil {
74-
return nil, err
75-
}
76-
paths := PathList{}
77-
for _, info := range infos {
78-
path := p.Join(info.Name())
79-
paths.Add(path)
80-
81-
if isDir, err := path.IsDirCheck(); err != nil {
82-
return nil, err
83-
} else if isDir {
84-
subPaths, err := path.ReadDirRecursive()
85-
if err != nil {
86-
return nil, err
87-
}
88-
paths.AddAll(subPaths)
89-
}
90-
91-
}
92-
return paths, nil
72+
return p.ReadDirRecursiveFiltered(nil)
9373
}
9474

9575
// ReadDirRecursiveFiltered returns a PathList containing the content of the directory

0 commit comments

Comments
 (0)