    # File lib/rubygems/format.rb, line 37
        def self.from_file_by_path(file_path, security_policy = nil)
          format = nil

          unless File.exist?(file_path)
            raise Gem::Exception, "Cannot load gem at [#{file_path}] in #{Dir.pwd}"
          end

          # check for old version gem
          if File.read(file_path, 20).include?("MD5SUM =")
            require 'rubygems/old_format'

            format = OldFormat.from_file_by_path(file_path)
          else
            open file_path, Gem.binary_mode do |io|
              format = from_io io, file_path, security_policy
            end
          end

          return format
        end