feat: support windows

Summary:
Add windows support by checking `dll` instead of `so` or `dylib` on windows in `libivy.lua`

Author: @ShaolunWang
Imported From: https://github.com/AdeAttwood/ivy.nvim/pull/90

Test Plan: None provided provided by the author.

Differential Revision: https://ph.baln.co.uk/D7
This commit is contained in:
ShaolunWang 2024-07-24 16:30:59 +01:00 committed by Ade Attwood
parent fef45c2d7e
commit f3585c8cde

View file

@ -1,7 +1,22 @@
local library_path = (function() local library_path = (function()
local root = string.sub(debug.getinfo(1).source, 2, #"/libivy.lua" * -1) local root = string.sub(debug.getinfo(1).source, 2, #"/libivy.lua" * -1)
local release_path = root .. "../../target/release" local release_path = root .. "../../target/release"
return package.searchpath("libivyrs", release_path .. "/?.so;" .. release_path .. "/?.dylib;") local current_vim_version = vim.version()
local minimum_supported_version = vim.version.parse "0.9.5"
local is_windows
if vim.version.gt(current_vim_version, minimum_supported_version) then
is_windows = vim.uv.os_uname().sysname == "Windows_NT"
else
is_windows = vim.loop.os_uname().sysname == "Windows_NT"
end
if is_windows then
return package.searchpath("ivyrs", release_path .. "/?.dll;")
else
return package.searchpath("libivyrs", release_path .. "/?.so;" .. release_path .. "/?.dylib;")
end
end)() end)()
local ffi = require "ffi" local ffi = require "ffi"