lib/easy_app_helper/core/config.rb
# Tries to find config files according to places (array) given and possible extensions
Tries to find config files according to places (array) given and possible extensions
Tries to find config files according to places ( array ) given and possible extensions
def find_file(places, filename)
    return nil if places.nil? or filename.nil? or filename.empty?
    places.each do |dir|
      CONFIG_FILE_POSSIBLE_EXTENSIONS.each do |ext|
        filename_with_path = dir + '/' + filename + '.' + ext
        if File.exists? filename_with_path and !File.directory? filename_with_path
          return filename_with_path 
        else
          logger.debug "Trying \"#{filename_with_path}\" as config file."
        end
      end
    end
    nil
  end
def find_file ( places , filename ) return nil if places . nil? or filename . nil? or filename . empty? places . each do | dir | CONFIG_FILE_POSSIBLE_EXTENSIONS . each do | ext | filename_with_path = dir + '/' + filename + '.' + ext if File . exists? filename_with_path and ! File . directory? filename_with_path return filename_with_path else logger . debug "Trying \"#{filename_with_path}\" as config file." end end end nil end
Tries to find config files according to places (array) given and possible extensions
Tries to find config files according to places ( array ) given and possible extensions
places
<not_specific>
filename
<not_specific>