summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-09-24 17:43:04 +0000
committerTed Trask <ttrask01@yahoo.com>2008-09-24 17:43:04 +0000
commitc6d537c4ee9e94ff5575d0c112984da0ac895220 (patch)
tree5706a21e89dff053606971c34bc2f3b876613a73
parent42b3d348e8794e9b0754034c7b958d2de62e414a (diff)
downloadacf-core-c6d537c4ee9e94ff5575d0c112984da0ac895220.tar.bz2
acf-core-c6d537c4ee9e94ff5575d0c112984da0ac895220.tar.xz
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
-rw-r--r--lib/fs.lua14
1 files changed, 8 insertions, 6 deletions
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