diff options
author | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-06-27 21:24:17 +0000 |
---|---|---|
committer | hisham <hisham@9ca3f7c1-7366-0410-b1a3-b5c78f85698c> | 2009-06-27 21:24:17 +0000 |
commit | 4b7f40cb05c6a9b5f838012d6e652d540d94f8cd (patch) | |
tree | 0a20e880e95c33e850208c051162e1f4597d9ee6 /src | |
parent | 6a196aca575412fcf9e1e5e69389c6e34d86cf2d (diff) | |
download | luarocks-4b7f40cb05c6a9b5f838012d6e652d540d94f8cd.tar.gz luarocks-4b7f40cb05c6a9b5f838012d6e652d540d94f8cd.tar.bz2 luarocks-4b7f40cb05c6a9b5f838012d6e652d540d94f8cd.zip |
cleaner path names
git-svn-id: http://luarocks.org/svn/luarocks/trunk@32 9ca3f7c1-7366-0410-b1a3-b5c78f85698c
Diffstat (limited to 'src')
-rw-r--r-- | src/luarocks/dir.lua | 5 |
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 "" |
26 | end | 26 | end |
27 | 27 | ||
28 | function strip_base_dir(pathname) | ||
29 | return pathname:gsub("^[^/]*/", "") | ||
30 | end | ||
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 |