class

Bindgen::FindPath

Inherits Reference < Object

Finds paths to files and directories, per user-configuration. Used to find dependencies of user projects in a somewhat portable fashion.

By default this class modifies ENV directly.

Constants

MULTILINE_OPTION = Regex::Options::MULTILINE_ONLY

Pure multi-line option. Crystal by defaults combines multi-line with the dot-all option, which we don't want.

PATH_SEPARATOR = ':'

Constructors

new(root : String, variables : ::ENV.class | Hash(String, String) = ENV)
Source

Instance methods

create_match_collector(config)

Returns a new MatchCollector decided by config.

Source
create_match_finder(search_paths, config, checkers)

Returns a new MatchFinder decided by config.

Source
find(config : PathConfig, additional = nil) : String | Nil

Finds a path for config. On success, returns the path as string. Returns nil on error.

If the match wants to set additional variables, it'll write them into the additional hash. If no additional is given, these variables are lost.

Source
find_all(config : Configuration, &) : Array(Error)

Finds all paths of config, yielding for each successful find. Unsuccessful matches are collected into an Error array and returned afterwards. If additional is given, additional variables set by matches are stored within it. If no additional is given, these variables are lost.

Source
find_all!(config : Configuration) : Array(Error)

Finds all paths of config, and adds missing ones to #variables. Returns a list of all encountered errors.

Source
root

Root path of the project.

Source
variables

Target variables hash. Will be read from and written to.

Source

Nested types