Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Filesystem
- explorer
- by Creator
- ]]--
- local filesystem = {}
- local function readFile(path)
- if not fs.exists(path) then
- return false, "No such file!"
- end
- local file = fs.open(path,"r")
- local variable = file.readAll()
- file.close()
- return variable
- end
- local append = [[
- local function writeFile(path,content)
- local file = fs.open(path,"w")
- file.write(content)
- file.close()
- end
- function writeDown(input, dir)
- for i,v in pairs(input) do
- writeFile(dir.."/"..i, v)
- end
- end
- args = {...}
- if #args == 0 then
- print("Please input a destination folder.")
- else
- writeDown(inputTable,args[1])
- end
- print("Finished installation...")
- ]]
- compress = function(basePath, paths, output)
- local files = {}
- assert(type(paths) == "table", "A table, bro!")
- for i,v in pairs(paths) do
- local data = readFile(basePath.."/"..v)
- if data then
- files[v] = data
- end
- end
- local file = fs.open(output,"w")
- file.write("inputTable = "..textutils.serialize(files).."\n\n\n\n\n\n\n\n\n"..append)
- file.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement