class ChefConfig::PathHelper

def self.canonical_path(path, add_prefix = true, windows: ChefUtils.windows?)

Produces a comparable path.
def self.canonical_path(path, add_prefix = true, windows: ChefUtils.windows?)
  # First remove extra separators and resolve any relative paths
  abs_path = File.absolute_path(path)
  if 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(windows: windows))
    if add_prefix && abs_path !~ /^\\\\?\\/
      abs_path.insert(0, "\\\\?\\")
    end
    abs_path.downcase!
  end
  abs_path
end