Skip to content

Commit 5e108bf

Browse files
authored
Fix to not explode when build.include is not used (#15)
1 parent 5d5fc45 commit 5e108bf

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/luarocks/build/rust-mlua.lua

+14-12
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,20 @@ function mlua.run(rockspec, no_install)
8585
end
8686
end
8787

88-
local cwd = dir.path(dir.dir_name(rockspec.local_abs_filename), rockspec.name)
89-
local luadir = path.lua_dir(rockspec.name, rockspec.version)
90-
91-
fs.make_dir(dir.dir_name(luadir))
92-
for from, to in pairs(rockspec.build.include) do
93-
if type(from) == "number" then
94-
from = to
95-
end
96-
to = dir.path(luadir, to)
97-
local ok, err = fs.copy(dir.path(cwd, from), to, "exec")
98-
if not ok then
99-
return nil, "Failed copying " .. from .. " in " .. to .. ": " .. err
88+
if rockspec.build.include then
89+
local cwd = dir.path(dir.dir_name(rockspec.local_abs_filename), rockspec.name)
90+
local luadir = path.lua_dir(rockspec.name, rockspec.version)
91+
92+
fs.make_dir(dir.dir_name(luadir))
93+
for from, to in pairs(rockspec.build.include) do
94+
if type(from) == "number" then
95+
from = to
96+
end
97+
to = dir.path(luadir, to)
98+
local ok, err = fs.copy(dir.path(cwd, from), to, "exec")
99+
if not ok then
100+
return nil, "Failed copying " .. from .. " in " .. to .. ": " .. err
101+
end
100102
end
101103
end
102104
end

0 commit comments

Comments
 (0)