Skip to content

Commit

Permalink
feat: support windows
Browse files Browse the repository at this point in the history
Summary:
Add windows support by checking `dll` instead of `so` or `dylib` on windows in `libivy.lua`

Author: @ShaolunWang
Imported From: #90

Test Plan: None provided provided by the author.

Differential Revision: https://ph.baln.co.uk/D7
  • Loading branch information
ShaolunWang authored and AdeAttwood committed Jul 24, 2024
1 parent fef45c2 commit f3585c8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lua/ivy/libivy.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
local library_path = (function()
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;")
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)()

local ffi = require "ffi"
Expand Down

0 comments on commit f3585c8

Please sign in to comment.