class ChefConfig::PathHelper
def self.home(*args)
that subsequent calls to home_dir don't bounce around.
Home-path discovery is performed once. If a path is discovered, that value is memoized so
valid and the result of the block is returned instead.
If an optional block is provided, the joined path is passed to that block if the home path is
homepath exists.
If a set of path elements is provided, they are appended as-is to the home path if the
If the home directory doesn't exist or an error is otherwise encountered, nil is returned.
of said directory. The path returned uses / for all separators (the ruby standard format).
Retrieves the "home directory" of the current user while trying to ascertain the existence
def self.home(*args) @@home_dir ||= all_homes { |p| break p } if @@home_dir path = File.join(@@home_dir, *args) block_given? ? (yield path) : path end end