From 033ff6510da63d87582c00b297bb5cb32c3eeac4 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 4 Jul 2016 22:00:22 -0400 Subject: Fixed inability to effectively halt `lfs.dir_foreach()` loops; core/lfs_ext.lua --- core/lfs_ext.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/lfs_ext.lua b/core/lfs_ext.lua index deaf0e89..7a4614f1 100644 --- a/core/lfs_ext.lua +++ b/core/lfs_ext.lua @@ -18,7 +18,7 @@ lfs.default_filter = { 'a', 'bmp', 'bz2', 'class', 'dll', 'exe', 'gif', 'gz', 'jar', 'jpeg', 'jpg', 'o', 'pdf', 'png', 'so', 'tar', 'tgz', 'tif', 'tiff', 'xz', 'zip' }, - folders = {'%.bzr$', '%.git$', '%.hg$', '%.svn$'} + folders = {'%.bzr$', '%.git$', '%.hg$', '%.svn$', 'node_modules'} } local lfs_symlinkattributes = lfs.symlinkattributes @@ -92,10 +92,12 @@ function lfs.dir_foreach(dir, f, filter, n, include_dirs, level) if mode == 'directory' and not exclude(filename, filter.folders) then if include_dirs and f(filename..dir_sep) == false then return end if not n or level < n then - lfs.dir_foreach(filename, f, filter, n, include_dirs, level + 1) + local halt = lfs.dir_foreach(filename, f, filter, n, include_dirs, + level + 1) == false + if halt then return false end end elseif mode == 'file' and not exclude(filename, filter) then - if f(filename) == false then return end + if f(filename) == false then return false end end end end -- cgit v1.2.3