8.18
Search Filesystem While Approaching Root Directory
| (require search-upward) | package: search-upward | 
Use this module to search for a specific file and/or directory
where the search walks up directories until hitting the root
of the associated filesystem.
value
upward-matcher/c : (-> directory-exists? (or/c path? #f))
A procedure that accepts a path to a directory D and returns a path
indicating a matching directory or file in D, or #f if
no match is found.
procedure
(search-upward include? [start]) → (listof path?)
include? : upward-matcher/c start : path? = (current-directory) 
Apply include? to start, start/.., start/../.., and so on up
until the applicable root directory. Returns a list of all paths from
include?, ordered by number of path elements (descending).
Returns an empty list if no match is found.
> (search-upward (λ (base) (directory-exists? (build-path base "node_modules"))) "/home/user/js-project/packageA/src/subpackageB") 
| '(#<path:/home/user/js-project/packageA/src/subpackageB/node_modules> | 
| #<path:/home/user/js-project/packageA/node_modules> | 
| #<path:/home/user/js-project/node_modules>) | 
procedure
(search-upward/first include? [start]) → (or/c path? #f)
include? : upward-matcher/c start : path? = (current-directory) 
Like search-upward, except the search will stop
on the first match and return the path for that match. Returns
#f if there is no match at the applicable root directory.
procedure
(directory-by-exact-name name) → upward-matcher/c
name : path-string? 
procedure
(file-by-exact-name name) → upward-matcher/c
name : path-string? 
procedure
(by-exact-name name) → upward-matcher/c
name : path-string? 
Each of these procedures return an upward-matcher/c that
checks if name exists in the given directory and is readable.
- directory-by-exact-name will only match if the name is for a directory.(search-upward (directory-by-exact-name "node_modules")) 
- file-by-exact-name will only match files.(search-upward (file-by-exact-name ".gitattributes")) 
- by-exact-name will match either files or directories.(search-upward (by-exact-name ".config"))