Skip to content

Commit

Permalink
fix(rocks): hererocks paths on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Jun 25, 2024
1 parent 0a5839c commit 45cd8d3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lua/lazy/manage/task/plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,22 @@ function B.rockspec(task)
---@type table<string, string>
local env = {}

local luarocks = "luarocks"
if Config.options.rocks.hererocks then
local hererocks = Config.options.rocks.root .. "/hererocks"
local sep = jit.os:find("Windows") and ";" or ":"
local is_win = jit.os:find("Windows")
local sep = is_win and ";" or ":"
local hererocks = Config.options.rocks.root .. "/hererocks/bin"
if is_win then
hererocks = hererocks:gsub("/", "\\")
end
local path = vim.split(vim.env.PATH, sep)
table.insert(path, 1, hererocks .. "/bin")
table.insert(path, 1, hererocks)
env = {
PATH = table.concat(path, sep),
}
if is_win then
luarocks = luarocks .. ".bat"
end
local plugin = Config.plugins.hererocks
-- hererocks is still building, so skip for now
if plugin and plugin._.build then
Expand All @@ -37,7 +45,7 @@ function B.rockspec(task)
end

local root = Config.options.rocks.root .. "/" .. task.plugin.name
task:spawn("luarocks", {
task:spawn(luarocks, {
args = {
"--tree",
root,
Expand Down

0 comments on commit 45cd8d3

Please sign in to comment.