Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local a=[[
- --pkg, a packaging program.
- --(c) Haddock, 2016
- --Run me to extract.
- ]]local b={...}local c={}local function d(e,f)for g,h in ipairs(fs.list(e))do local i=e..'/'..h;if h=='.DS_Store'or h=='.gitignore'or h=='.git'or i=='/rom'or i=='/'..shell.getRunningProgram()or h=='/'..shell.getRunningProgram()or h=="pkg"or h=="pkg.lua"or i=="pkg"or i=="pkg.lua"then print("Not including "..h)elseif fs.isDir(i)then f[h]={}d(i,f[h])else local j=fs.open(i,'r')if j then f[h]=j.readAll()j.close()end end end end;d(shell.dir(),c)print("Packing...")a=a..'local files = '..textutils.serialize(c)..'\n'a=a..[[
- local function extract()
- local function node(path, tree)
- if type(tree) == 'table' then
- fs.makeDir(path)
- for k, v in pairs(tree) do
- node(path .. '/' .. k, v)
- end
- else
- local f = fs.open(path, 'w')
- if f then
- f.write(tree)
- f.close()
- end
- end
- end
- node(shell.dir(), files)
- end
- extract()
- ]]local j=fs.open(shell.dir()..'/out.pkg','w')j.write(a)j.close()print("Package wrote to "..shell.dir().."/out.pkg")
Advertisement
Add Comment
Please, Sign In to add comment