Fix issue #36 and #44

This issue was related to Lua not handling coroutines iterators right, the function being recursive generated multiple coroutine iterators and they didn't resume right. The solution is to make the first loop non-recursive and create a secondary loop where the recursive function is called.
This commit is contained in:
Pablo Ariel Mayobre
2017-05-19 04:01:05 -03:00
committed by Antonin Décimo
parent 339cbe7b42
commit 7d5532ebe4

View File

@@ -62,20 +62,25 @@ end
-- @local
local _buildFileTree
_buildFileTree = function(dir)
local subDir
local subDirs = {}
for file in assert(fs.dir()) do
if not file:find("^%.git") then
if fs.is_dir(file) then
subDir = {}
dir[file] = subDir
assert(fs.change_dir(file))
_buildFileTree(subDir, file)
assert(fs.pop_dir())
subDirs[#subDirs + 1] = file
elseif fs.is_file(file) then
dir[#dir+1] = file
end
end
end
for _, path in ipairs(subDirs) do
local newDir = {}
dir[path] = newDir
assert(fs.change_dir(path))
_buildFileTree(newDir)
assert(fs.pop_dir())
end
end
--- Recursive function to check if file should be excluded based