fix: copy on windows

This commit is contained in:
əlemi 2024-09-28 01:19:05 +02:00
parent 5ec9f8050e
commit 2b869bb7ab
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -51,6 +51,17 @@ if os_uname.sysname == "Windows_NT" then
}) })
print("downloading in background... library will be installed upon restart") print("downloading in background... library will be installed upon restart")
vim.api.nvim_create_autocmd(
{"ExitPre"},
{
callback = function (_ev)
local handle, pid = vim.uv.spawn("cmd.exe", {
args = { "move", "/Y", native_path, replace_native_path }
})
end
}
)
else else
local res = vim.system({"curl", "-o", native_path, download_url_native }):wait() -- TODO can we run this asynchronously? local res = vim.system({"curl", "-o", native_path, download_url_native }):wait() -- TODO can we run this asynchronously?
print(res.stdout) print(res.stdout)
@ -63,8 +74,6 @@ else
print(res.stdout) print(res.stdout)
print(res.stderr) print(res.stderr)
end end
end
vim.api.nvim_create_autocmd( vim.api.nvim_create_autocmd(
{"ExitPre"}, {"ExitPre"},
{ {
@ -73,3 +82,5 @@ vim.api.nvim_create_autocmd(
end end
} }
) )
end