# File lib/rubygems/commands/unpack_command.rb, line 67
  def get_path(gemname, version_req)
    return gemname if gemname =~ /\.gem$/i
    specs = Gem::SourceIndex.from_installed_gems.search(/\A#{gemname}\z/, version_req)
    selected = specs.sort_by { |s| s.version }.last
    return nil if selected.nil?
    # We expect to find (basename).gem in the 'cache' directory.
    # Furthermore, the name match must be exact (ignoring case).
    if gemname =~ /^#{selected.name}$/i
      filename = selected.full_name + '.gem'
      return File.join(Gem.dir, 'cache', filename)
    else
      return nil
    end
  end