Sha256: a953fd919ca9ed77c10f4afe274255c7686bd95efa6330f23312cd556902d016

Contents?: true

Size: 698 Bytes

Versions: 6

Compression:

Stored size: 698 Bytes

Contents

require "libmspack"

module Excavate
  module Extractors
    class CabExtractor < Extractor
      def extract(target)
        open_cab(@archive) do |decompressor, cab|
          file = cab.files

          while file
            path = File.join(target, file.filename)
            decompressor.extract(file, path)
            file = file.next
          end
        end
      end

      private

      def open_cab(archive)
        decompressor = LibMsPack::CabDecompressor.new
        cab = Utils.silence_stream($stderr) do
          decompressor.search(archive)
        end

        yield decompressor, cab

        decompressor.close(cab)
        decompressor.destroy
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
excavate-0.3.7 lib/excavate/extractors/cab_extractor.rb
excavate-0.3.6 lib/excavate/extractors/cab_extractor.rb
excavate-0.3.5 lib/excavate/extractors/cab_extractor.rb
excavate-0.3.4 lib/excavate/extractors/cab_extractor.rb
excavate-0.3.3 lib/excavate/extractors/cab_extractor.rb
excavate-0.3.2 lib/excavate/extractors/cab_extractor.rb