MCPcopy
hub / github.com/go-task/task / SearchPathRecursively

Function SearchPathRecursively

internal/fsext/fs.go:154–166  ·  view source on GitHub ↗

SearchPathRecursively walks up the directory tree starting at the given path, calling the Search function in each directory until it finds a matching file or reaches the root directory. On supported operating systems, it will also check if the user ID of the directory changes and abort if it does.

(path string, possibleFilenames []string)

Source from the content-addressed store, hash-verified

152// file or reaches the root directory. On supported operating systems, it will
153// also check if the user ID of the directory changes and abort if it does.
154func SearchPathRecursively(path string, possibleFilenames []string) (string, error) {
155 paths, err := SearchNPathRecursively(path, possibleFilenames, 1)
156 if len(paths) > 0 {
157 // Regardless of the error, return the first possible filename.
158 return paths[0], nil
159 } else {
160 if err != nil {
161 return "", err
162 } else {
163 return "", os.ErrNotExist
164 }
165 }
166}
167
168// SearchNPathRecursively walks up the directory tree starting at the given
169// path, calling the Search function in each directory and adding each matching

Callers 1

SearchFunction · 0.85

Calls 1

SearchNPathRecursivelyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…