Module: FFI::Compiler::Loader
- Defined in:
- lib/ffi-compiler/loader.rb,
lib/ffi-compiler/fake_ffi/ffi-compiler/loader.rb
Class Method Summary collapse
Class Method Details
.find(*args) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ffi-compiler/loader.rb', line 8 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 |