1
0
mirror of https://github.com/Adorable-Catgirl/Zorya-NEO.git synced 2024-11-14 14:38:04 +11:00
Zorya-NEO/util/OpenOS/config.d/97_addent.lua

19 lines
488 B
Lua
Raw Normal View History

2020-03-20 07:50:37 +11:00
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