Method: Selenium::WebDriver::Zipper.unzip

Defined in:
lib/selenium/webdriver/common/zipper.rb

.unzip(path) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/selenium/webdriver/common/zipper.rb', line 37

def unzip(path)
  destination = Dir.mktmpdir('webdriver-unzip')
  FileReaper << destination

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

      FileUtils.mkdir_p dirname
      if RUBYZIP_V3
        zip.extract(entry, entry.name, destination_directory: destination)
      else
        zip.extract(entry, to)
      end
    end
  end

  destination
end