Module: Inky::Native

Extended by:
Fiddle::Importer
Defined in:
lib/inky.rb

Constant Summary collapse

LIB_NAMES =
case RUBY_PLATFORM
when /darwin/  then ["libinky.dylib"]
when /mingw|mswin/ then ["inky.dll"]
else ["libinky.so"]
end

Class Method Summary collapse

Class Method Details

.find_libraryObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inky.rb', line 22

def self.find_library
  name = LIB_NAMES.first
  candidates = [
    # Development: cargo build output
    File.join(__dir__, "..", "..", "..", "target", "release", name),
    File.join(__dir__, "..", "..", "..", "target", "debug", name),
    # Bundled with gem
    File.join(__dir__, name),
    # System paths
    File.join("/usr/local/lib", name),
    File.join("/usr/lib", name),
  ]

  candidates.each do |path|
    resolved = File.expand_path(path)
    return resolved if File.exist?(resolved)
  end

  nil
end