summaryrefslogtreecommitdiffstats
path: root/lib/roles.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-01-24 16:52:21 +0000
committerTed Trask <ttrask01@yahoo.com>2009-01-24 16:52:21 +0000
commit80f200377d7ed85ae3f6a93348b386bb63b4aeed (patch)
treee93a6adee26e92e79299309b89d8a2be57b9fcf8 /lib/roles.lua
parenta96cb599a24a578a98af2e70da40037c00a7db6b (diff)
downloadacf-core-80f200377d7ed85ae3f6a93348b386bb63b4aeed.tar.bz2
acf-core-80f200377d7ed85ae3f6a93348b386bb63b4aeed.tar.xz
Started process of removing as many io.popen calls as possible. Not complete.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1695 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/roles.lua')
-rw-r--r--lib/roles.lua16
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/roles.lua b/lib/roles.lua
index e57490e..1ca8ae2 100644
--- a/lib/roles.lua
+++ b/lib/roles.lua
@@ -11,24 +11,18 @@ guest_role = "GUEST"
-- returns a table of the *.roles files
-- startdir should be the app dir
local get_roles_candidates = function (startdir)
- local t = {}
- local fh = io.popen('find ' .. format.escapespecialcharacters(startdir) .. ' -name "*.roles"')
- for x in fh:lines() do
- t[#t + 1] = x
- end
- return t
+ return fs.find_files_as_array(".*%.roles", startdir) or {}
end
-- Return a list of *controller.lua files
list_controllers = function(self)
local list = {}
- local f = io.popen("/usr/bin/find /usr/share/acf/ |/bin/grep \"controller.lua$\" ")
- for a in f:lines() do
- if not string.find(a, "acf_") then
- list[#list + 1 ] = a
+ for file in fs.find(".*controller%.lua", "/usr/share/acf") do
+ if not string.find(file, "acf_") then
+ list[#list + 1] = file
end
end
- f:close()
+
return list
end