From 4b7f40cb05c6a9b5f838012d6e652d540d94f8cd Mon Sep 17 00:00:00 2001 From: hisham Date: Sat, 27 Jun 2009 21:24:17 +0000 Subject: cleaner path names git-svn-id: http://luarocks.org/svn/luarocks/trunk@32 9ca3f7c1-7366-0410-b1a3-b5c78f85698c --- src/luarocks/dir.lua | 5 +++++ 1 file changed, 5 insertions(+) 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) return (pathname:gsub("/*$", ""):match("(.*/)[^/]*")) or "" end +function strip_base_dir(pathname) + return pathname:gsub("^[^/]*/", "") +end + --- Describe a path in a cross-platform way. -- Use this function to avoid platform-specific directory -- separators in other modules. If the first item contains a @@ -37,6 +41,7 @@ function path(...) local items = {...} local i = 1 while items[i] do + items[i] = items[i]:gsub("/*$", "") if items[i] == "" then table.remove(items, i) else -- cgit v1.2.3-55-g6feb