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.lua23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua
index c39056b4..220e7b29 100644
--- a/src/luarocks/cfg.lua
+++ b/src/luarocks/cfg.lua
@@ -1,6 +1,6 @@
1 1
2local rawset, next, table, pairs, print, require, io, os, setmetatable, pcall, ipairs, package = 2local rawset, next, table, pairs, print, require, io, os, setmetatable, pcall, ipairs, package, type =
3 rawset, next, table, pairs, print, require, io, os, setmetatable, pcall, ipairs, package 3 rawset, next, table, pairs, print, require, io, os, setmetatable, pcall, ipairs, package, type
4 4
5--- Configuration for LuaRocks. 5--- Configuration for LuaRocks.
6-- Tries to load the user's configuration file and 6-- Tries to load the user's configuration file and
@@ -22,6 +22,8 @@ if not ok then
22 config = {} 22 config = {}
23end 23end
24 24
25_M.config = config
26
25program_version = "2.0.2" 27program_version = "2.0.2"
26user_agent = "LuaRocks/"..program_version 28user_agent = "LuaRocks/"..program_version
27 29
@@ -117,15 +119,10 @@ end
117 119
118-- Configure defaults: 120-- Configure defaults:
119 121
120local root = config.LUAROCKS_ROCKS_TREE or home_tree 122local root = rocks_trees[#rocks_trees]
121local defaults = { 123local defaults = {
122 root_dir = root,
123 rocks_dir = root.."/lib/luarocks/rocks",
124 lua_modules_path = "/share/lua/5.1/", 124 lua_modules_path = "/share/lua/5.1/",
125 lib_modules_path = "/lib/lua/5.1/", 125 lib_modules_path = "/lib/lua/5.1/",
126 deploy_bin_dir = root.."/bin/",
127 deploy_lua_dir = root.."/share/lua/5.1/",
128 deploy_lib_dir = root.."/lib/lua/5.1/",
129 126
130 arch = "unknown", 127 arch = "unknown",
131 lib_extension = "unknown", 128 lib_extension = "unknown",
@@ -289,7 +286,13 @@ setmetatable(_M, cfg_mt)
289 286
290 287
291for _,tree in ipairs(rocks_trees) do 288for _,tree in ipairs(rocks_trees) do
292 package.path = tree..lua_modules_path.."/?.lua;"..tree..lua_modules_path.."/?/init.lua;"..package.path 289 if type(tree) == "string" then
293 package.cpath = tree..lib_modules_path.."/?."..lib_extension..";"..package.cpath 290 package.path = tree..lua_modules_path.."/?.lua;"..tree..lua_modules_path.."/?/init.lua;"..package.path
291 package.cpath = tree..lib_modules_path.."/?."..lib_extension..";"..package.cpath
292 else
293 package.path = (tree.lua_dir or tree.root..lua_modules_path).."/?.lua;"..
294 (tree.lua_dir or tree.root..lua_modules_path).."/?/init.lua;"..package.path
295 package.cpath = (tree.lib_dir or tree.root..lib_modules_path).."/?."..lib_extension..";"..package.cpath
296 end
294end 297end
295 298