def find_real_file(dir, name, options)
found = possible_files(remove_root(name)).map do |f, s|
path = (dir == "." || Pathname.new(f).absolute?) ? f : "#{dir}/#{f}"
Dir[path].map do |full_path|
full_path.gsub!(REDUNDANT_DIRECTORY, File::SEPARATOR)
[full_path, s]
end
end
found = Sass::Util.flatten(found, 1)
return if found.empty?
if found.size > 1 && !@same_name_warnings.include?(found.first.first)
found.each {|(f, _)| @same_name_warnings << f}
relative_to = Pathname.new(dir)
if options[:_line]
candidates = found.map {|(f, _)| " " + Pathname.new(f).relative_path_from(relative_to).to_s}.join("\n")
Sass::Util.sass_warn "WARNING: On line \#{options[:_line]}\#{\" of \#{options[:filename]}\" if options[:filename]}:\n It's not clear which file to import for '@import \"\#{name}\"'.\n Candidates:\n\#{candidates}\n For now I'll choose \#{File.basename found.first.first}.\n This will be an error in future versions of Sass.\n"
else
candidates = found.map {|(f, _)| " " + File.basename(f)}.join("\n")
Sass::Util.sass_warn "WARNING: In \#{File.dirname(name)}:\n There are multiple files that match the name \"\#{File.basename(name)}\":\n\#{candidates}\n"
end
end
found.first
end