# File lib/rubygems/installer.rb, line 569
  def extract_files
    raise ArgumentError, "format required to extract from" if @format.nil?

    @format.file_entries.each do |entry, file_data|
      path = entry['path'].untaint

      if path.start_with? "/" then # for extra sanity
        raise Gem::InstallError, "attempt to install file into #{entry['path']}"
      end

      path = File.expand_path File.join(gem_dir, path)

      unless path.start_with? gem_dir then
        msg = "attempt to install file into %p under %s" %
                [entry['path'], gem_dir]
        raise Gem::InstallError, msg
      end

      FileUtils.rm_rf(path) if File.exist? path

      dir = File.dirname path
      FileUtils.mkdir_p dir unless File.exist? dir

      File.open(path, "wb") do |out|
        out.write file_data
      end

      FileUtils.chmod entry['mode'], path

      say path if Gem.configuration.really_verbose
    end
  end