Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,25 +16,6 @@ CSharpOptions:
|
|
| 16 |
EntryPointName: Game
|
| 17 |
MainMethodName: Main
|
| 18 |
AssemblyName: ExampleProject""")
|
| 19 |
-
def check_dotnet_installed():
|
| 20 |
-
try:
|
| 21 |
-
result = subprocess.run(['dotnet', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
| 22 |
-
if result.returncode == 0:
|
| 23 |
-
print(f".NET is already installed. Version: {result.stdout.strip()}")
|
| 24 |
-
return True
|
| 25 |
-
else:
|
| 26 |
-
print("Unable to find .NET installed.")
|
| 27 |
-
return False
|
| 28 |
-
except FileNotFoundError:
|
| 29 |
-
print(".NET is not installed.")
|
| 30 |
-
return False
|
| 31 |
-
|
| 32 |
-
def install_dotnet():
|
| 33 |
-
print("Installing .NET SDK...")
|
| 34 |
-
|
| 35 |
-
# Dont know what to do!?
|
| 36 |
-
|
| 37 |
-
print(".NET SDK has been installed.")
|
| 38 |
def compile(cs):
|
| 39 |
# Create file
|
| 40 |
with open(file_path, 'w') as file:
|
|
@@ -43,7 +24,7 @@ def compile(cs):
|
|
| 43 |
# Run command
|
| 44 |
try:
|
| 45 |
result = subprocess.run(
|
| 46 |
-
['dotnet', 'run', '--project roblox-cs-master/RobloxCS.CLI/RobloxCS.CLI.csproj'],
|
| 47 |
capture_output=True,
|
| 48 |
text=True,
|
| 49 |
check=True
|
|
@@ -55,7 +36,5 @@ def compile(cs):
|
|
| 55 |
|
| 56 |
return 'ha'
|
| 57 |
|
| 58 |
-
if not check_dotnet_installed():
|
| 59 |
-
install_dotnet()
|
| 60 |
demo = gr.Interface(fn=compile, inputs="text", outputs="text")
|
| 61 |
demo.launch()
|
|
|
|
| 16 |
EntryPointName: Game
|
| 17 |
MainMethodName: Main
|
| 18 |
AssemblyName: ExampleProject""")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
def compile(cs):
|
| 20 |
# Create file
|
| 21 |
with open(file_path, 'w') as file:
|
|
|
|
| 24 |
# Run command
|
| 25 |
try:
|
| 26 |
result = subprocess.run(
|
| 27 |
+
['./dotnet/dotnet', 'run', '--project roblox-cs-master/RobloxCS.CLI/RobloxCS.CLI.csproj'],
|
| 28 |
capture_output=True,
|
| 29 |
text=True,
|
| 30 |
check=True
|
|
|
|
| 36 |
|
| 37 |
return 'ha'
|
| 38 |
|
|
|
|
|
|
|
| 39 |
demo = gr.Interface(fn=compile, inputs="text", outputs="text")
|
| 40 |
demo.launch()
|