diff options
Diffstat (limited to 'src/luarocks/cfg.lua')
-rw-r--r-- | src/luarocks/cfg.lua | 28 |
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 | } |
444 | setmetatable(_M, cfg_mt) | 444 | setmetatable(_M, cfg_mt) |
445 | 445 | ||
446 | for _,tree in ipairs(rocks_trees) do | 446 | function 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, ";") | ||
459 | end | ||
460 | |||
461 | do | ||
462 | local new_path, new_cpath = package_paths() | ||
463 | package.path = new_path..";"..package.path | ||
464 | package.cpath = new_cpath..";"..package.cpath | ||
455 | end | 465 | end |
456 | 466 | ||
457 | function which_config() | 467 | function which_config() |