Given a fn
, we may wish to run it on a filepath
, determine
its success, and try again with the parent directory of filepath
,
until we obtain result that is not NULL
. If this does not occur for
any parent directory, we halt with the string error
.
traverse_parent_directories(filepath, fn, error)
filepath | character. The filepath to traverse along. The |
---|---|
fn | function. A one-argument function called on |
error | character or function. A string to error if |
The result of fn
on the first parent directory of
filepath
on which it is not NULL
.