add multifile thing?

This commit is contained in:
v
2021-01-02 14:58:12 +00:00
parent 94e6615afc
commit 58b39788f3
2 changed files with 34 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
local mfs=dofile "/lib/mfs.lua"
local res={}
function res.pack(filename,pf)
if not pf then
pf=filename
filename=""
end
local res2=""
if mfs.type(pf.."/"..filename)=="directory" then
res2=res2.."if not fs.exists('"..filename.."') then fs.makeDir('"..filename.."') end "
local l=fs.list(pf.."/"..filename)
for i,v in ipairs(l) do
res2=res2..res.pack(filename.."/"..v,pf)
end
else
res2=res2.."f=fs.open('"..filename.."','w') f.write("..("%q"):format(mfs.read(pf.."/"..filename))..") f.close() "
end
return res2
end
return res