private Method

XmlSimple.find_xml_file(file, searchpath)

Searches in a list of paths for a certain file. Returns the full path to the file, if it could be found. Otherwise, an exception will be raised.

filename:Name of the file to search for.
searchpath:List of paths to search in.

Source Code

# File active_support/vendor/xml-simple-1.0.11/xmlsimple.rb, line 963
def find_xml_file(file, searchpath)
  filename = File::basename(file)

  if filename != file
    return file if File::file?(file)
  else
    searchpath.each { |path|
      full_path = File::join(path, filename)
      return full_path if File::file?(full_path)
    }
  end

  if searchpath.empty?
    return file if File::file?(file)
    raise ArgumentError, "File does not exist: #{file}."
  end
  raise ArgumentError, "Could not find <#{filename}> in <#{searchpath.join(':')}>"
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.