# File lib/kwala/lib/cycle_detector.rb, line 659
  def self.find_file(file)
    return nil if file =~ /\.so$/

    if file !~ /\.rb$/
      nfile = file + ".rb"
    else
      nfile = file
    end

    [file, nfile].uniq.each do |chk|
      if File.exists?(chk) && !File.directory?(chk)
        return chk
      end
    end

    filter_path($LOAD_PATH).each do |path|
      #$LOAD_PATH.each do |path|
      npath = path + "/" + nfile
      if File.exists?(npath) && !File.directory?(npath)
        return npath
      end
    end
    nil
  end