forked from gitter-badger/Pixel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMake.lua
More file actions
51 lines (42 loc) · 1006 Bytes
/
Make.lua
File metadata and controls
51 lines (42 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--[[
Name: Make
Author: Wassil Janssen a.k.a. Creator
Licence: GNU GENERAL PUBLIC LICENSE
Description: A tool designed to compile the source code of Pixel
]]--
local final = ""
tArgs = {...}
if not tArgs[1] then error("Provide a destination filename.") end
local function readf(path)
if not fs.exists(path) then error(path.." does not exist!") end
local file, two = fs.open(path,"r")
local data = file.readAll()
file.close()
return data
end
local function add(txt)
final = final.."\n\n"..txt
end
local function explore(path)
for i,v in pairs(fs.list(path)) do
local fpath = path.."/"..v
if fs.isDir(fpath) then
explore(fpath)
else
add(readf(fpath))
end
end
end
add(readf("Pixel/BuildHeader"))
explore("Pixel/Objects")
local file = fs.open("/Pixel/Builds/"..tArgs[1],"w")
file.write(final)
file.close()
local file = fs.open("Pixel/Pixel","w")
file.write(final)
file.close()
if tArgs[2] then
local file = fs.open("Pixel/Build","w")
file.write(tArgs[1])
file.close()
end