1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-05 19:31:35 +00:00

Properly closing all files in Python code

This commit is contained in:
Viktor Ferenczi
2018-03-10 18:37:33 +01:00
parent eceba5aa6a
commit 272ecddb28
13 changed files with 142 additions and 112 deletions

View File

@@ -16,9 +16,7 @@ READ_CONSTANTS = 2
read_what = READ_TYPES
for x in (range(len(sys.argv) - 1)):
f = open(sys.argv[x + 1], "r")
def read_file(f):
while(True):
line = f.readline()
@@ -86,6 +84,9 @@ for x in (range(len(sys.argv) - 1)):
functions.append(funcdata)
print(funcdata)
for path in sys.argv[1:]:
with open(path, "r") as f:
read_file(f)
# print(types)
# print(constants)
@@ -156,6 +157,7 @@ f.write("void glWrapperInit( GLWrapperFuncPtr (*wrapperFunc)(const char*) );\n")
f.write("#ifdef __cplusplus\n}\n#endif\n")
f.write("#endif\n\n")
f.close()
f = open("glwrapper.c", "w")
@@ -176,3 +178,4 @@ for x in functions:
f.write("\n\n")
f.write("}\n")
f.write("\n\n")
f.close()