require 'zip/zip'

module Selenium
  module WebDriver

    module ZipHelper

      module_function

      def unzip(path)
        destination = Dir.mktmpdir("unzip")
        FileReaper << destination

        Zip::ZipFile.open(path) do |zip|
          zip.each do |entry|
            zip.extract(entry, File.join(destination, entry.name))
          end
        end

        destination
      end


    end # ZipHelper
  end # WebDriver
end # Selenium

require 'zip/zip'

module Selenium
  module WebDriver

    module ZipHelper

      module_function

      def unzip(path)
        destination = Dir.mktmpdir("unzip")
        FileReaper << destination

        Zip::ZipFile.open(path) do |zip|
          zip.each do |entry|
            to = File.join(destination, entry.name)
            FileUtils.mkdir_p File.dirname(to)

            zip.extract(entry, to)
          end
        end

        destination
      end


    end # ZipHelper
  end # WebDriver
end # Selenium

Fix scoping issue on Ruby 1.8 and make sure dirs exist when unzipping.
JariBakken: Fix scoping issue on Ruby 1.8 and make sure dirs exist when unzipping.

git-svn-id: 4179480af2c2519a5eb5e1e9b541cbdf5cf27696@9225 07704840-8298-11de-bf8c-fd130f914ac9
