convert luci.fs users to nixio.fs api
[project/luci.git] / libs / web / luasrc / dispatcher.lua
index 8fddf02122a2294b1d390387e967c828e9123f85..37008b5946ae73ffabcaaacfb5e8d7a2f3028d6b 100644 (file)
@@ -25,7 +25,7 @@ limitations under the License.
 ]]--
 
 --- LuCI web dispatcher.
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
 local sys = require "luci.sys"
 local init = require "luci.init"
 local util = require "luci.util"
@@ -394,19 +394,16 @@ end
 function createindex_plain(path, suffixes)
        local controllers = { }
        for _, suffix in ipairs(suffixes) do
-               controllers = util.combine(
-                       controllers,
-                       luci.fs.glob(path .. "*" .. suffix) or {},
-                       luci.fs.glob(path .. "*/*" .. suffix) or {}
-               )
+               nixio.util.consume((fs.glob(path .. "*" .. suffix)), controllers)
+               nixio.util.consume((fs.glob(path .. "*/*" .. suffix)), controllers)
        end
 
        if indexcache then
-               local cachedate = fs.mtime(indexcache)
+               local cachedate = fs.stat(indexcache, "mtime")
                if cachedate then
                        local realdate = 0
                        for _, obj in ipairs(controllers) do
-                               local omtime = fs.mtime(path .. "/" .. obj)
+                               local omtime = fs.stat(path .. "/" .. obj, "mtime")
                                realdate = (omtime and omtime > realdate) and omtime or realdate
                        end