class ChefConfig::PathHelper

def self.canonical_path(path, add_prefix = true)

Produces a comparable path.
def self.canonical_path(path, add_prefix = true)
  # First remove extra separators and resolve any relative paths
  abs_path = File.absolute_path(path)
  if ChefConfig.windows?
    # Add the \\?\ API prefix on Windows unless add_prefix is false
    # Downcase on Windows where paths are still case-insensitive
    abs_path.gsub!(::File::SEPARATOR, path_separator)
    if add_prefix && abs_path !~ /^\\\\?\\/
      abs_path.insert(0, "\\\\?\\")
    end
    abs_path.downcase!
  end
  abs_path
end