fix: use package.searchpath to find libivyrs

Now we are useing the package.searchpath to find the libivyrs.so or
libivyrs.dylib. This is so it will load the correct library or the OS
you are on. This fixes the issues with loading the library on macOS.

Ref: #57
This commit is contained in:
Ade Attwood 2023-06-09 19:07:01 +01:00
parent de7f9a2292
commit 0bd6770da4

View file

@ -1,6 +1,7 @@
local library_path = (function()
local dirname = string.sub(debug.getinfo(1).source, 2, #"/fzf_lib.lua" * -1)
return dirname .. "/../../target/release/libivyrs.so"
local root = string.sub(debug.getinfo(1).source, 2, #"/libivy.lua" * -1)
local release_path = root .. "../../target/release"
return package.searchpath("libivyrs", release_path .. "/?.so;" .. release_path .. "/?.dylib;")
end)()
local ffi = require "ffi"