Sha256: 1490268359b0cf84247466c2c142fc7f7642df80fa54e983fd99366b08686a1e
Contents?: true
Size: 734 Bytes
Versions: 3
Compression:
Stored size: 734 Bytes
Contents
require 'pathname' require 'ffi' require_relative 'platform' module FFI module Compiler module Loader def self.find(name, start_path = nil) library = Platform.system.map_library_name(name) root = false Pathname.new(start_path || File.dirname(caller[0].split(/:/)[0])).ascend do |path| Dir.glob("#{path}/**/{#{FFI::Platform::ARCH}-#{FFI::Platform::OS}/#{library},#{library}}") do |f| return f end break if root # Next iteration will be the root of the gem if this is the lib/ dir - stop after that root = File.basename(path) == 'lib' end raise LoadError.new("cannot find '#{name}' library") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ffi-compiler-0.1.2 | lib/ffi-compiler/loader.rb |
ffi-compiler-0.1.1 | lib/ffi-compiler/loader.rb |
ffi-compiler-0.1.0 | lib/ffi-compiler/loader.rb |