summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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