instance method
find_xml_file
Ruby on Rails 2.2.3
Since v2.2.3 Last seen in v2.2.3 PrivateSignature
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.
Parameters
-
filereq -
searchpathreq
Source
# File activesupport/lib/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
Defined in activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb line 963
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in XmlSimple