diff options
Diffstat (limited to 'src/luarocks/path.lua')
-rw-r--r-- | src/luarocks/path.lua | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/luarocks/path.lua b/src/luarocks/path.lua index d07c244e..3ff0db8a 100644 --- a/src/luarocks/path.lua +++ b/src/luarocks/path.lua | |||
@@ -7,6 +7,14 @@ module("luarocks.path", package.seeall) | |||
7 | local dir = require("luarocks.dir") | 7 | local dir = require("luarocks.dir") |
8 | local cfg = require("luarocks.cfg") | 8 | local cfg = require("luarocks.cfg") |
9 | 9 | ||
10 | help_summary = "Return the currently configured package path." | ||
11 | help_arguments = "" | ||
12 | help = [[ | ||
13 | Returns the package path currently configured for this installation | ||
14 | of LuaRocks, formatted as shell commands to update LUA_PATH and | ||
15 | LUA_CPATH. (On Unix systems, you may run: eval `luarocks path`) | ||
16 | ]] | ||
17 | |||
10 | --- Infer rockspec filename from a rock filename. | 18 | --- Infer rockspec filename from a rock filename. |
11 | -- @param rock_name string: Pathname of a rock file. | 19 | -- @param rock_name string: Pathname of a rock file. |
12 | -- @return string: Filename of the rockspec, without path. | 20 | -- @return string: Filename of the rockspec, without path. |
@@ -291,3 +299,17 @@ function versioned_name(file, prefix, name, version) | |||
291 | local name_version = (name.."_"..version):gsub("%-", "_"):gsub("%.", "_") | 299 | local name_version = (name.."_"..version):gsub("%-", "_"):gsub("%.", "_") |
292 | return dir.path(prefix, name_version.."-"..rest) | 300 | return dir.path(prefix, name_version.."-"..rest) |
293 | end | 301 | end |
302 | |||
303 | --- Driver function for "path" command. | ||
304 | -- @return boolean This function always succeeds. | ||
305 | function run(...) | ||
306 | if cfg.is_platform("unix") then | ||
307 | print("export LUA_PATH='"..package.path.."'") | ||
308 | print("export LUA_CPATH='"..package.cpath.."'") | ||
309 | elseif cfg.is_platform("windows") then | ||
310 | print("SET LUA_PATH="..package.path) | ||
311 | print("SET LUA_CPATH="..package.cpath) | ||
312 | end | ||
313 | return true | ||
314 | end | ||
315 | |||