14
14
15
15
16
16
17
-
18
17
def cppcompile (r , file , pluscount = False ):
19
- if file .endswith (".cpp" ):
18
+ if file .endswith (".cpp" ) and os . environ . get ( "ENABLE_BETA_RPYC" ) == True :
20
19
# compile the file to a file with the same name and path but .lua
21
20
try :
22
21
newctranslator = parser .CodeConverter (file , getconfig ("c" , "dynamiclibpath" , "None" ))
@@ -58,8 +57,17 @@ def cppcompile(r, file, pluscount=False):
58
57
#count += 1
59
58
60
59
return 0
60
+ else :
61
+ print (error ("C is not enabled, please enable it in the config." ))
62
+ if pluscount :
63
+ #pluscount.error()
64
+ pluscount .update (1 )
65
+ pluscount .current += 1
66
+ #global count
67
+ #count += 1
68
+ return 0
61
69
def ccompile (r , file , pluscount = False ):
62
- if file .endswith (".c" ):
70
+ if file .endswith (".c" ) and os . environ . get ( "ENABLE_BETA_RPYC" ) == True :
63
71
# compile the file to a file with the same name and path but .lua
64
72
try :
65
73
newctranslator = parser .CodeConverter (file , getconfig ("c" , "dynamiclibpath" , "None" ))
@@ -102,6 +110,15 @@ def ccompile(r, file, pluscount=False):
102
110
#global count
103
111
#count += 1
104
112
return 0
113
+ else :
114
+ print (error ("C is not enabled, please enable it in the config." ))
115
+ if pluscount :
116
+ #pluscount.error()
117
+ pluscount .update (1 )
118
+ pluscount .current += 1
119
+ #global count
120
+ #count += 1
121
+ return 0
105
122
def pycompile (r , file , pluscount = False ):
106
123
# compile the file to a file with the same name and path but .lua
107
124
contents = ""
@@ -180,8 +197,7 @@ def lunarcompile(r, file, pluscount=False):
180
197
#print(colortext.green("Compiled "+os.path.join(r, file)))
181
198
with open (os .path .join (r , file .replace (".moon" , ".lua" )), "r" ) as f :
182
199
contents = f .read ()
183
- with open (os .path .join (r , file .replace (".moon" , ".lua" )), "w" ) as f :
184
- f .write (newheader + contents + header .pyfooter )
200
+ contents = backwordreplace (contents , "return" , "" , 1 )
185
201
186
202
else :
187
203
print (error ("File error for " + os .path .join (r , file )+ "!" ))
@@ -219,3 +235,16 @@ def robloxtscompile(r, file, pluscount=False):
219
235
#global count
220
236
#count += 1
221
237
return 0
238
+ def allcompile (r , file , pluscount ):
239
+ # Checks what file it is then redirects to the correct compiler
240
+ if file .endswith (".py" ):
241
+ pycompile (r , file , pluscount )
242
+ elif file .endswith (".moon" ):
243
+ lunarcompile (r , file , pluscount )
244
+ elif file .endswith (".c" ):
245
+ ccompile (r , file , pluscount )
246
+ elif file .endswith (".cpp" ):
247
+ cppcompile (r , file , pluscount )
248
+ elif file .endswith (".ts" ):
249
+ robloxtscompile (r , file , pluscount )
250
+
0 commit comments