aboutsummaryrefslogtreecommitdiff
path: root/src/luarocks/path.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/luarocks/path.lua')
-rw-r--r--src/luarocks/path.lua22
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)
7local dir = require("luarocks.dir") 7local dir = require("luarocks.dir")
8local cfg = require("luarocks.cfg") 8local cfg = require("luarocks.cfg")
9 9
10help_summary = "Return the currently configured package path."
11help_arguments = ""
12help = [[
13Returns the package path currently configured for this installation
14of LuaRocks, formatted as shell commands to update LUA_PATH and
15LUA_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)
293end 301end
302
303--- Driver function for "path" command.
304-- @return boolean This function always succeeds.
305function 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
314end
315