Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

searching a bunch of places before giving up

  • Loading branch information...
commit c0b60d415c2210d551cd2a2653dc7f5b149b4b19 1 parent ee1e129
@tenderlove authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 lib/earworm_lib.rb
View
16 lib/earworm_lib.rb
@@ -1,7 +1,21 @@
require 'dl/import'
module EarwormLib # :nodoc:
extend DL::Importable
- dlload('/opt/local/lib/libofa.dylib')
+ loaded = false
+ libs = %w{ libofa.dylib libofa.so libofa.so.0 }
+ dirs = %w{ /opt/local/lib /usr/local/lib }
+ libs += libs.map { |lib| dirs.map { |dir| File.join(dir, lib) } }.flatten
+ libs.each do |so|
+ begin
+ dlload(so)
+ loaded = true
+ break
+ rescue
+ next
+ end
+ end
+ raise "Please install libofa" unless loaded
+
extern "void ofa_get_version(int *, int *, int *)"
extern "const char * ofa_create_print(const char *, int, long, int, int)"
end
Please sign in to comment.
Something went wrong with that request. Please try again.