From c6d537c4ee9e94ff5575d0c112984da0ac895220 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 24 Sep 2008 17:43:04 +0000 Subject: Workaround in fs.lua for exception caused by posix.files when directory doesn't exist. git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1491 ab2d0c66-481e-0410-8bed-d214d4d58bed --- lib/fs.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/fs.lua b/lib/fs.lua index 31e8f13..943fb85 100644 --- a/lib/fs.lua +++ b/lib/fs.lua @@ -117,14 +117,16 @@ function find ( what, where ) where = where or posix.getcwd() f = f or ".*" t = t or {} - for d in posix.files ( where ) do - if fs.is_dir ( where .. "/" .. d ) and (d ~= ".") and ( d ~= "..") then - find_files_as_array (f, where .. "/" .. d, t ) - end - if (string.match (d, "^" .. f .. "$" )) then - table.insert (t, ( string.gsub ( where .. "/" .. d, "/+", "/" ) ) ) + if fs.is_dir(where) then + for d in posix.files ( where ) do + if fs.is_dir ( where .. "/" .. d ) and (d ~= ".") and ( d ~= "..") then + find_files_as_array (f, where .. "/" .. d, t ) + end + if (string.match (d, "^" .. f .. "$" )) then + table.insert (t, ( string.gsub ( where .. "/" .. d, "/+", "/" ) ) ) end end + end return (t) end -- cgit v1.2.3