Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -148,9 +148,16 @@ def generate_script():
|
|
148 |
with open(script_path, 'w') as file:
|
149 |
file.write(modified_cs)
|
150 |
|
151 |
-
|
152 |
compile_command = f'csc /target:winexe /platform:x64 /out:run.exe {script_path} /win32icon:app.ico /win32manifest:app.manifest'
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
# Provide a link to download the compiled executable
|
156 |
return send_file('run.exe', as_attachment=True)
|
|
|
148 |
with open(script_path, 'w') as file:
|
149 |
file.write(modified_cs)
|
150 |
|
151 |
+
# Step 10: Compile the C# script using csc
|
152 |
compile_command = f'csc /target:winexe /platform:x64 /out:run.exe {script_path} /win32icon:app.ico /win32manifest:app.manifest'
|
153 |
+
|
154 |
+
# Run the compilation command and capture the output
|
155 |
+
result = subprocess.run(compile_command, shell=True, capture_output=True, text=True)
|
156 |
+
|
157 |
+
if result.returncode != 0:
|
158 |
+
# Log the error to the console or handle it as needed
|
159 |
+
print("Compilation failed:", result.stderr)
|
160 |
+
return f"Error during compilation: {result.stderr}", 500
|
161 |
|
162 |
# Provide a link to download the compiled executable
|
163 |
return send_file('run.exe', as_attachment=True)
|