Skip to content

Commit

Permalink
fix(installer): proper C lib file extension on darwin and windows (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb authored Mar 13, 2024
1 parent b96de8f commit 855d556
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions installer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,8 @@ local function install()
pcall(vim.api.nvim_win_close, data.window, true)
end

local sysname = vim.uv.os_uname().sysname:lower()
local lib_extension = (sysname:find("windows") and "dll") or (sysname:find("darwin") and "dylib") or "so"
acquire_buffer_lock(buffer, function()
vim.api.nvim_buf_set_lines(buffer, 0, -1, true, {
"INSTALLATION COMPLETE",
Expand All @@ -408,8 +410,12 @@ local function install()
' package.path = package.path .. ";" .. table.concat(luarocks_path, ";")',
" ",
" local luarocks_cpath = {",
' vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),',
' vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),',
(' vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.%s"),'):format(
lib_extension
),
(' vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.%s"),'):format(
lib_extension
),
" }",
' package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")',
" ",
Expand Down Expand Up @@ -441,8 +447,12 @@ local function install()
'package.path = package.path .. ";" .. table.concat(luarocks_path, ";")',
"",
"local luarocks_cpath = {",
' vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),',
' vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),',
(' vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.%s"),'):format(
lib_extension
),
(' vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.%s"),'):format(
lib_extension
),
"}",
'package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")',
"",
Expand Down

0 comments on commit 855d556

Please sign in to comment.