lib/thundersvm.rb in thundersvm-0.1.0 vs lib/thundersvm.rb in thundersvm-0.1.1

- old
+ new

@@ -13,10 +13,19 @@ class Error < StandardError; end class << self attr_accessor :ffi_lib end - self.ffi_lib = ["libthundersvm.so", "libthundersvm.dylib", "thundersvm.dll"] + lib_name = + if Gem.win_platform? + "thundersvm.dll" + elsif RbConfig::CONFIG["host_os"] =~ /darwin/i + "libthundersvm.dylib" + else + "libthundersvm.so" + end + vendor_lib = File.expand_path("../vendor/#{lib_name}", __dir__) + self.ffi_lib = [vendor_lib] # friendlier error message autoload :FFI, "thundersvm/ffi" def self.load_model(path)