diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2015-02-18 20:02:58 -0200 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-02-18 20:02:58 -0200 |
commit | 48847a41fb3b3a14e59282f988df87c076d80a82 (patch) | |
tree | 16f0b84fcd13a715a18a4df4bee376a30ba106eb | |
parent | 23afae679d904356d6c130bc99b918d9c37fd5f5 (diff) | |
download | luarocks-48847a41fb3b3a14e59282f988df87c076d80a82.tar.gz luarocks-48847a41fb3b3a14e59282f988df87c076d80a82.tar.bz2 luarocks-48847a41fb3b3a14e59282f988df87c076d80a82.zip |
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.
-rw-r--r-- | src/luarocks/path.lua | 5 |
1 files changed, 4 insertions, 1 deletions
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, ...) | |||
339 | return result | 339 | return result |
340 | end | 340 | end |
341 | 341 | ||
342 | local is_src_extension = { [".lua"] = true, [".tl"] = true, [".tld"] = true, [".moon"] = true } | ||
343 | |||
342 | --- Return the pathname of the file that would be loaded for a module, indexed. | 344 | --- Return the pathname of the file that would be loaded for a module, indexed. |
343 | -- @param module_name string: module name (eg. "socket.core") | 345 | -- @param module_name string: module name (eg. "socket.core") |
344 | -- @param name string: name of the package (eg. "luasocket") | 346 | -- @param name string: name of the package (eg. "luasocket") |
@@ -349,7 +351,8 @@ end | |||
349 | -- @return string: filename of the module (eg. "/usr/local/lib/lua/5.1/socket/core.so") | 351 | -- @return string: filename of the module (eg. "/usr/local/lib/lua/5.1/socket/core.so") |
350 | function path.which_i(module_name, name, version, tree, i) | 352 | function path.which_i(module_name, name, version, tree, i) |
351 | local deploy_dir | 353 | local deploy_dir |
352 | if module_name:match("%.lua$") then | 354 | local extension = module_name:match("%.[a-z]+$") |
355 | if is_src_extension[extension] then | ||
353 | deploy_dir = path.deploy_lua_dir(tree) | 356 | deploy_dir = path.deploy_lua_dir(tree) |
354 | module_name = dir.path(deploy_dir, module_name) | 357 | module_name = dir.path(deploy_dir, module_name) |
355 | else | 358 | else |