summaryrefslogtreecommitdiffhomepage
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fs.lua12
-rw-r--r--core/src/menu.lua13
2 files changed, 8 insertions, 17 deletions
diff --git a/core/src/fs.lua b/core/src/fs.lua
index 0ca191be9..4639ac4a8 100644
--- a/core/src/fs.lua
+++ b/core/src/fs.lua
@@ -29,9 +29,7 @@ module("ffluci.fs", package.seeall)
require("posix")
-- Glob
-function glob(pattern)
- return posix.glob(pattern)
-end
+glob = posix.glob
-- Checks whether a file exists
function isfile(filename)
@@ -79,13 +77,7 @@ basename = posix.basename
dirname = posix.dirname
-- dir wrapper
-function dir(path)
- local dir = {}
- for node in posix.files(path) do
- table.insert(dir, 1, node)
- end
- return dir
-end
+dir = posix.dir
-- Alias for posix.mkdir
mkdir = posix.mkdir
diff --git a/core/src/menu.lua b/core/src/menu.lua
index 5724b2cb9..d6f65116e 100644
--- a/core/src/menu.lua
+++ b/core/src/menu.lua
@@ -30,7 +30,7 @@ require("ffluci.util")
require("ffluci.sys")
-- Default modelpath
-modelpath = ffluci.sys.libpath() .. "/model/menu/"
+modelpattern = ffluci.sys.libpath() .. "/model/menu/*.lua"
-- Menu definition extra scope
scope = {
@@ -100,12 +100,11 @@ end
function collect()
local generators = {}
- for k, menu in pairs(ffluci.fs.dir(modelpath)) do
- if menu:sub(1, 1) ~= "." then
- local f = loadfile(modelpath.."/"..menu)
- if f then
- table.insert(generators, f)
- end
+ local m = ffluci.fs.glob(modelpattern) or {}
+ for k, menu in pairs(m) do
+ local f = loadfile(menu)
+ if f then
+ table.insert(generators, f)
end
end