From 14edfeda8988f8de7dd5d236130ec9e0418a7cab Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 30 Jan 2009 13:55:23 +0000 Subject: Fixed bug in fs.find_files_as_array. git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1698 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lib/fs.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/fs.lua b/lib/fs.lua index 15ce442..63991d4 100644 --- a/lib/fs.lua +++ b/lib/fs.lua @@ -154,10 +154,11 @@ function find_files_as_array ( what, where, t ) t = t or {} if fs.is_dir(where) then for d in posix.files ( where ) do - if fs.is_dir ( where .. "/" .. d ) and (d ~= ".") and ( d ~= "..") then + if (d == ".") or ( d == "..") then + -- do nothing + elseif fs.is_dir ( where .. "/" .. d ) then find_files_as_array (what, where .. "/" .. d, t ) - end - if (string.match (d, "^" .. what .. "$" )) then + elseif (string.match (d, "^" .. what .. "$" )) then table.insert (t, ( string.gsub ( where .. "/" .. d, "/+", "/" ) ) ) end end -- cgit v1.2.3