From 48847a41fb3b3a14e59282f988df87c076d80a82 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 18 Feb 2015 20:02:58 -0200 Subject: Support more file extensions as source files. This "guesses" the location of files instead of confirming in the filesystem that they are really under share/ or lib/, but this is used by the module loader, so we better not load luarocks.fs and the whole kitchen sink at this point. --- src/luarocks/path.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua index 598e51d9..fb5eec7e 100644 --- a/src/luarocks/path.lua +++ b/src/luarocks/path.lua @@ -339,6 +339,8 @@ function path.map_trees(deps_mode, fn, ...) return result end +local is_src_extension = { [".lua"] = true, [".tl"] = true, [".tld"] = true, [".moon"] = true } + --- Return the pathname of the file that would be loaded for a module, indexed. -- @param module_name string: module name (eg. "socket.core") -- @param name string: name of the package (eg. "luasocket") @@ -349,7 +351,8 @@ end -- @return string: filename of the module (eg. "/usr/local/lib/lua/5.1/socket/core.so") function path.which_i(module_name, name, version, tree, i) local deploy_dir - if module_name:match("%.lua$") then + local extension = module_name:match("%.[a-z]+$") + if is_src_extension[extension] then deploy_dir = path.deploy_lua_dir(tree) module_name = dir.path(deploy_dir, module_name) else -- cgit v1.2.3-55-g6feb