aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/luarocks/dir.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/luarocks/dir.lua b/src/luarocks/dir.lua
index b8f6bbd3..5a8058dc 100644
--- a/src/luarocks/dir.lua
+++ b/src/luarocks/dir.lua
@@ -25,6 +25,10 @@ function dir_name(pathname)
25 return (pathname:gsub("/*$", ""):match("(.*/)[^/]*")) or "" 25 return (pathname:gsub("/*$", ""):match("(.*/)[^/]*")) or ""
26end 26end
27 27
28function strip_base_dir(pathname)
29 return pathname:gsub("^[^/]*/", "")
30end
31
28--- Describe a path in a cross-platform way. 32--- Describe a path in a cross-platform way.
29-- Use this function to avoid platform-specific directory 33-- Use this function to avoid platform-specific directory
30-- separators in other modules. If the first item contains a 34-- separators in other modules. If the first item contains a
@@ -37,6 +41,7 @@ function path(...)
37 local items = {...} 41 local items = {...}
38 local i = 1 42 local i = 1
39 while items[i] do 43 while items[i] do
44 items[i] = items[i]:gsub("/*$", "")
40 if items[i] == "" then 45 if items[i] == "" then
41 table.remove(items, i) 46 table.remove(items, i)
42 else 47 else