class ChefConfig::PathHelper

def self.join(*args)

def self.join(*args)
  path_separator_regex = Regexp.escape(File::SEPARATOR)
  unless path_separator == File::SEPARATOR
    path_separator_regex << Regexp.escape(path_separator)
  end
  trailing_slashes = /[#{path_separator_regex}]+$/
  leading_slashes = /^[#{path_separator_regex}]+/
  args.flatten.inject() do |joined_path, component|
    joined_path = joined_path.sub(trailing_slashes, "")
    component = component.sub(leading_slashes, "")
    joined_path + "#{path_separator}#{component}"
  end
end