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



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/inky.rb', line 39

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