2024-09-05 05:16:18 +02:00
|
|
|
local plugin_dir = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h") -- got this from https://lazy.folke.io/developers#building
|
2024-09-05 05:27:00 +02:00
|
|
|
|
2024-09-05 05:38:45 +02:00
|
|
|
-- -- TODO not the best loader but a simple example? urls dont work
|
|
|
|
-- local host_os = vim.loop.os_uname().sysname
|
|
|
|
-- local ext = nil
|
|
|
|
-- if host_os == "Windows" then ext = ".dll"
|
|
|
|
-- elseif host_os == "Mac" then ext = ".dylib"
|
|
|
|
-- else ext = ".so"
|
|
|
|
-- end
|
|
|
|
--
|
|
|
|
-- local shasum = nil
|
|
|
|
--
|
|
|
|
-- if vim.fn.filereadable(path .. 'native' .. ext) == 1 then
|
|
|
|
-- shasum = vim.fn.system("sha256sum " .. path .. 'native' .. ext)
|
|
|
|
-- end
|
|
|
|
--
|
|
|
|
-- local last_sum = vim.fn.system("curl -s https://codemp.alemi.dev/lib/lua/latest/sum")
|
|
|
|
--
|
|
|
|
-- if last_sum ~= shasum then
|
|
|
|
-- vim.fn.system("curl -o " .. path .. 'native' .. ext .. "https://codemp.alemi.dev/lib/lua/latest")
|
|
|
|
-- end
|
2024-09-05 05:27:00 +02:00
|
|
|
local native_path = plugin_dir .. "/lua/codemp/native.so" -- TODO get extension based on platform
|
2024-09-06 03:26:30 +02:00
|
|
|
local download_url_native = "https://codemp.dev/releases/lua/codemp_native-linux.so" -- TODO get url based on platform
|
2024-09-05 05:45:46 +02:00
|
|
|
print("downloading codemp native lua extension...")
|
2024-09-06 03:26:30 +02:00
|
|
|
vim.system({"curl", "-s", "-o", native_path, download_url_native }):wait() -- TODO can we run this asynchronously?
|