1
0
mirror of https://github.com/Adorable-Catgirl/Zorya-NEO.git synced 2024-11-14 22:38:07 +11:00
Zorya-NEO/util/OpenOS/config.d/97_addent.lua
2020-03-19 15:50:37 -05:00

19 lines
488 B
Lua

local cfgadd = ...
local fs = require("filesystem")
if not fs.exists("/etc/zorya-neo/entries/") then
return
end
local function readfile(path)
local f = io.open(path)
local dat = f:read("*a")
f:close()
return dat
end
for ent in fs.list("/etc/zorya-neo/entries/") do
local label = readfile("/etc/zorya-neo/entries/"..ent.."/label.txt")
local code = readfile("/etc/zorya-neo/entries/"..ent.."/code.lua")
cfgadd(string.format([[
menu.add("%s", function())
%s
end)]], label, code))
end