Sha256: d22b50d98077b21c06a1bc2f70a5e7eb3a7534f10fcab46091563d5cb2c1e5b4

Contents?: true

Size: 840 Bytes

Versions: 35

Compression:

Stored size: 840 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.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

35 entries across 35 versions & 1 rubygems

Version Path
ffi-libarchive-binary-0.4.0 lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0-x86_64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0-x86_64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0-arm64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0-aarch64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0.rc1 lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0.rc1-x86_64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0.rc1-x86_64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0.rc1-arm64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.4.0.rc1-aarch64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.4 lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.4-x86_64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.4-x86_64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.4-arm64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.4-aarch64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.2 lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.2-x86_64-linux lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.2-x86_64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.2-arm64-darwin lib/ffi-libarchive-binary.rb
ffi-libarchive-binary-0.3.2-aarch64-linux lib/ffi-libarchive-binary.rb