diff options
| -rw-r--r-- | src/luarocks/cmd/init.lua | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/luarocks/cmd/init.lua b/src/luarocks/cmd/init.lua index d4d3cf64..20aa97a1 100644 --- a/src/luarocks/cmd/init.lua +++ b/src/luarocks/cmd/init.lua | |||
| @@ -55,6 +55,22 @@ local function write_gitignore(entries) | |||
| 55 | fd:close() | 55 | fd:close() |
| 56 | end | 56 | end |
| 57 | 57 | ||
| 58 | local function inject_tree(tree) | ||
| 59 | path.use_tree(tree) | ||
| 60 | local tree_set = false | ||
| 61 | for _, t in ipairs(cfg.rocks_trees) do | ||
| 62 | if type(t) == "table" then | ||
| 63 | if t.name == "project" then | ||
| 64 | t.root = tree | ||
| 65 | tree_set = true | ||
| 66 | end | ||
| 67 | end | ||
| 68 | end | ||
| 69 | if not tree_set then | ||
| 70 | table.insert(cfg.rocks_trees, 1, { name = "project", root = tree }) | ||
| 71 | end | ||
| 72 | end | ||
| 73 | |||
| 58 | local function write_wrapper_scripts(wrapper_dir, luarocks_wrapper, lua_wrapper) | 74 | local function write_wrapper_scripts(wrapper_dir, luarocks_wrapper, lua_wrapper) |
| 59 | local tree = dir.path(fs.current_dir(), "lua_modules") | 75 | local tree = dir.path(fs.current_dir(), "lua_modules") |
| 60 | 76 | ||
| @@ -80,7 +96,10 @@ local function write_wrapper_scripts(wrapper_dir, luarocks_wrapper, lua_wrapper) | |||
| 80 | if write_lua_wrapper then | 96 | if write_lua_wrapper then |
| 81 | if util.check_lua_version(cfg.variables.LUA, cfg.lua_version) then | 97 | if util.check_lua_version(cfg.variables.LUA, cfg.lua_version) then |
| 82 | util.printout("Preparing " .. lua_wrapper .. " for version " .. cfg.lua_version .. "...") | 98 | util.printout("Preparing " .. lua_wrapper .. " for version " .. cfg.lua_version .. "...") |
| 83 | path.use_tree(tree) | 99 | |
| 100 | -- Inject tree so it shows up as a lookup path in the wrappers | ||
| 101 | inject_tree(tree) | ||
| 102 | |||
| 84 | fs.wrap_script(nil, lua_wrapper, "all") | 103 | fs.wrap_script(nil, lua_wrapper, "all") |
| 85 | else | 104 | else |
| 86 | util.warning("No Lua interpreter detected for version " .. cfg.lua_version .. ". Not creating " .. lua_wrapper) | 105 | util.warning("No Lua interpreter detected for version " .. cfg.lua_version .. ". Not creating " .. lua_wrapper) |
