23 lines
550 B
Lua
23 lines
550 B
Lua
|
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
|