aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/cfg.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/cfg.lua')
-rw-r--r--src/luarocks/cfg.lua28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index 259293c3..967d756c 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -443,15 +443,25 @@ local cfg_mt = {
443} 443}
444setmetatable(_M, cfg_mt) 444setmetatable(_M, cfg_mt)
445 445
446for _,tree in ipairs(rocks_trees) do 446function package_paths()
447 if type(tree) == "string" then 447 local new_path, new_cpath = {}, {}
448 package.path = tree..lua_modules_path.."/?.lua;"..tree..lua_modules_path.."/?/init.lua;"..package.path 448 for _,tree in ipairs(rocks_trees) do
449 package.cpath = tree..lib_modules_path.."/?."..lib_extension..";"..package.cpath 449 if type(tree) == "string" then
450 else 450 table.insert(new_path, 1, tree..lua_modules_path.."/?.lua;"..tree..lua_modules_path.."/?/init.lua")
451 package.path = (tree.lua_dir or tree.root..lua_modules_path).."/?.lua;".. 451 table.insert(new_cpath, 1, tree..lib_modules_path.."/?."..lib_extension)
452 (tree.lua_dir or tree.root..lua_modules_path).."/?/init.lua;"..package.path 452 else
453 package.cpath = (tree.lib_dir or tree.root..lib_modules_path).."/?."..lib_extension..";"..package.cpath 453 table.insert(new_path, 1, (tree.lua_dir or tree.root..lua_modules_path).."/?.lua;"..
454 end 454 (tree.lua_dir or tree.root..lua_modules_path).."/?/init.lua")
455 table.insert(new_cpath, 1, (tree.lib_dir or tree.root..lib_modules_path).."/?."..lib_extension)
456 end
457 end
458 return table.concat(new_path, ";"), table.concat(new_cpath, ";")
459end
460
461do
462 local new_path, new_cpath = package_paths()
463 package.path = new_path..";"..package.path
464 package.cpath = new_cpath..";"..package.cpath
455end 465end
456 466
457function which_config() 467function which_config()