# File lib/more/facets/fileutils/whereis.rb, line 23
  def whereis(prog, path=ENV['PATH']) #:yield:
    dirs = []
    path.split(File::PATH_SEPARATOR).each{|dir|
        # Windows checks against specific extensions
        if File::ALT_SEPARATOR
          if prog.include?('.')
              f = File.join(dir,prog)
              if File.executable?(f) && !File.directory?(f)
                if block_given?
                    yield f.gsub(/\//,'\\')
                else
                    dirs << f.gsub(/\//,'\\')
                end
              end
          else
              Win32Exts.find_all{|ext|
                f = File.join(dir,prog+ext)
                if File.executable?(f) && !File.directory?(f)
                    if block_given?
                      yield f.gsub(/\//,'\\')
                    else
                      dirs << f.gsub(/\//,'\\')
                    end
                end
              }
          end
        else
          f = File.join(dir,prog)
          # Avoid /usr/lib/ruby, for example
          if File.executable?(f) && !File.directory?(f)
              if block_given?
                yield f
              else
                dirs << f
              end
          end
        end
    }
    dirs.empty? ? nil : dirs
  end