-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerateUpdate.py
More file actions
45 lines (35 loc) · 1.14 KB
/
generateUpdate.py
File metadata and controls
45 lines (35 loc) · 1.14 KB
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
import os
def wCreateDir(path):
path = path.replace(".\\", "")
path = path.replace("\\", "/")
print("Creating dir: " + path)
file.write("print(\"Creating dir: " + path + "\")\n")
file.write("fs.makeDir(\"" + path + "\")\n")
file = open("updatetc.lua", "w+")
for dirname, dirnames, filenames in os.walk('.'):
filenames = [f for f in filenames if not f[0] == '.']
dirnames[:] = [d for d in dirnames if not d[0] == '.']
# create dirs
for subdirname in dirnames:
wCreateDir(os.path.join(dirname, subdirname))
# print path to all filenames.
for filename in filenames:
if filename == "updatetc.lua":
continue
if ".lua" not in filename:
continue
path = os.path.join(dirname, filename)
f = open(path)
text = "[[" + f.read() + "]]\n"
path = path.replace(".\\", "")
path = path.replace(".lua", "")
path = path.replace("\\", "/")
print("Adding file: " + path)
file.write("print(\"Creating file: " + path + "\")\n")
file.write("file = fs.open(\"" + path + "\", \"w\")\n")
file.write("text = " + text)
file.write("file.write(text)\n")
file.write("file.close()\n")
file.close()
print("Done. Enter to exit.")
input()