diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2013-09-26 02:12:25 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2013-09-26 02:12:25 -0300 |
| commit | 606c29d80dd939cccc21c7278cc20d3300df2576 (patch) | |
| tree | c66ae263dbba2c38591e20f4c3140aded7c8690c /src | |
| parent | 890e7bbb3907a913a461a3320beed8dc987448d9 (diff) | |
| download | luarocks-606c29d80dd939cccc21c7278cc20d3300df2576.tar.gz luarocks-606c29d80dd939cccc21c7278cc20d3300df2576.tar.bz2 luarocks-606c29d80dd939cccc21c7278cc20d3300df2576.zip | |
Remove trailing space from dir_name; do not rely on setfenv to check for Lua 5.1, this breaks users of 'strict' globals checker
Diffstat (limited to 'src')
| -rw-r--r-- | src/luarocks/dir.lua | 7 | ||||
| -rw-r--r-- | src/luarocks/persist.lua | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/luarocks/dir.lua b/src/luarocks/dir.lua index b496c962..3c7465bb 100644 --- a/src/luarocks/dir.lua +++ b/src/luarocks/dir.lua | |||
| @@ -17,13 +17,12 @@ end | |||
| 17 | 17 | ||
| 18 | --- Strip the name off a path+filename. | 18 | --- Strip the name off a path+filename. |
| 19 | -- @param pathname string: A path+name, such as "/a/b/c". | 19 | -- @param pathname string: A path+name, such as "/a/b/c". |
| 20 | -- @return string: The filename without its path, such as "/a/b/". | 20 | -- @return string: The filename without its path, such as "/a/b". |
| 21 | -- For entries such as "/a/b/", "/a/" is returned. If there are | 21 | -- For entries such as "/a/b/", "/a" is returned. If there are |
| 22 | -- no directory separators in input, "" is returned. | 22 | -- no directory separators in input, "" is returned. |
| 23 | function dir_name(pathname) | 23 | function dir_name(pathname) |
| 24 | assert(type(pathname) == "string") | 24 | assert(type(pathname) == "string") |
| 25 | 25 | return (pathname:gsub("/*$", ""):match("(.*)[/]+[^/]*")) or "" | |
| 26 | return (pathname:gsub("/*$", ""):match("(.*/)[^/]*")) or "" | ||
| 27 | end | 26 | end |
| 28 | 27 | ||
| 29 | --- Describe a path in a cross-platform way. | 28 | --- Describe a path in a cross-platform way. |
diff --git a/src/luarocks/persist.lua b/src/luarocks/persist.lua index 208aee02..376a242a 100644 --- a/src/luarocks/persist.lua +++ b/src/luarocks/persist.lua | |||
| @@ -20,7 +20,7 @@ function load_into_table(filename, tbl) | |||
| 20 | 20 | ||
| 21 | local result, chunk, ran, err | 21 | local result, chunk, ran, err |
| 22 | local result = tbl or {} | 22 | local result = tbl or {} |
| 23 | if setfenv then -- Lua 5.1 | 23 | if _VERSION == "Lua 5.1" then -- Lua 5.1 |
| 24 | chunk, err = loadfile(filename) | 24 | chunk, err = loadfile(filename) |
| 25 | if chunk then | 25 | if chunk then |
| 26 | setfenv(chunk, result) | 26 | setfenv(chunk, result) |
