fix: correct trim path ()

This commit is contained in:
Aaron Pham 2024-08-16 01:54:44 -04:00 committed by GitHub
parent de22014785
commit ce5d421c98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -19,10 +19,15 @@ H.library_path = function()
return dirname .. ("../build/?.%s"):format(ext)
end
---@type fun(s: string): string
local trim_semicolon = function(s)
return s:sub(-1) == ";" and s:sub(1, -2) or s
end
M.load = function()
local library_path = H.library_path()
if not string.find(package.cpath, library_path, 1, true) then
package.cpath = package.cpath .. ";" .. library_path
package.cpath = trim_semicolon(package.cpath) .. ";" .. library_path
end
end