diff options
-rw-r--r-- | core/lfs_ext.lua | 2 | ||||
-rw-r--r-- | test/test.lua | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/core/lfs_ext.lua b/core/lfs_ext.lua index d55dbf0b..842c1737 100644 --- a/core/lfs_ext.lua +++ b/core/lfs_ext.lua @@ -85,7 +85,7 @@ end -- @see filter -- @name walk function lfs.walk(dir, filter, n, include_dirs) - dir = assert_type(dir, 'string', 1):match('^(.-)[/\\]?$') + dir = assert_type(dir, 'string', 1):match('^(..-)[/\\]?$') if not assert_type(filter, 'string/table/nil', 2) then filter = lfs.default_filter end diff --git a/test/test.lua b/test/test.lua index 53a7cb24..8a768731 100644 --- a/test/test.lua +++ b/test/test.lua @@ -759,6 +759,11 @@ function test_lfs_ext_walk_symlinks() os.execute('rm -r ' .. dir) end +function test_lfs_ext_walk_root() + local filename = lfs.walk('/', nil, 0, true)() + assert(not filename:find('lfs_ext.lua:'), 'coroutine error') +end + function test_lfs_ext_abs_path() assert_equal(lfs.abspath('bar', '/foo'), '/foo/bar') assert_equal(lfs.abspath('./bar', '/foo'), '/foo/bar') |