Sha256: a7fe09f03111e3960cfdb9c3bc4bc6d8d1d6fff36500bf8d15cc92e00e7097ef

Contents?: true

Size: 843 Bytes

Versions: 15

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

require "ffi-libarchive-binary/version"
require "pathname"

module LibarchiveBinary
  class Error < StandardError; end

  LIBRARY_PATH = Pathname.new(File.join(__dir__, "ffi-libarchive-binary"))

  def self.lib_path
    LIBRARY_PATH.join(lib_filename).to_s
  end

  def self.lib_filename
    if FFI::Platform.windows?
      "libarchive-13.dll"
    elsif FFI::Platform.mac?
      "libarchive.dylib"
    else
      "libarchive.so"
    end
  end
end

module Archive
  module C
    def self.ffi_lib(*args)
      prefixed = args.map do |names|
        paths = names.is_a?(Array) ? names : [names]
        if paths.any? { |f| f.include?("libarchive") }
          [LibarchiveBinary.lib_path] + paths
        else
          names
        end
      end

      super(*prefixed)
    end
  end
end

require "ffi-libarchive"

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ffi-libarchive-binary-0.2.6 lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.6-x86_64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.6-x86_64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.6-x86-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.6-arm64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.5 lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.5-x86_64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.5-x86_64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.5-x86-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.5-arm64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.4 lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.4-x86_64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.4-x86_64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.4-x86-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.2.4-arm64-darwin lib/ffi-libarchive-binary.rb