fix supervisor location

This commit is contained in:
CommonLoon102 2020-01-25 01:36:53 +01:00
parent 496ad6629b
commit df689c5d68

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
@ -24,8 +25,9 @@ namespace WebInterface
string supervisor = "Supervisor"; string supervisor = "Supervisor";
if (isWindows) if (isWindows)
supervisor += ".exe"; supervisor += ".exe";
if (!File.Exists(supervisor)) string supervisorPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), supervisor);
throw new Exception($"Couldn't find {supervisor} in {Directory.GetCurrentDirectory()}"); if (!File.Exists(supervisorPath))
throw new Exception($"Couldn't find {supervisor} at {supervisorPath}");
Process.Start(supervisor); Process.Start(supervisor);
} }