var pluginPaths = new List<string>(config.Paths);
var libraryPaths = new List<string>(config.LibraryPaths);
- var rootFolder = DirUtils.GetExecutableDirectory();
+ var rootFolder = Directory.GetCurrentDirectory();
pluginPaths.Add(Path.Combine(rootFolder, "plugins"));
libraryPaths.Add(Path.Combine(rootFolder, "libraries"));
using System;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Reflection;
using Impostor.Api.Events.Managers;
using Impostor.Api.Games;
using Impostor.Api.Games.Managers;
.MinimumLevel.Override("Microsoft", LogEventLevel.Debug)
#else
.MinimumLevel.Information()
- .MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
+ .MinimumLevel.Override("Microsoft", LogEventLevel.Information)
#endif
.Enrich.FromLogContext()
.WriteTo.Console()
try
{
- Log.Information("Starting Impostor");
+ var assembly = Assembly.GetExecutingAssembly();
+ var fileVersion = FileVersionInfo.GetVersionInfo(assembly.Location);
+
+ Log.Information("Starting Impostor v{0}", fileVersion.ProductVersion);
CreateHostBuilder(args).Build().Run();
return 0;
}
.Get<PluginConfig>() ?? new PluginConfig();
return Host.CreateDefaultBuilder(args)
- .UseContentRoot(DirUtils.GetExecutableDirectory())
+ .UseContentRoot(Directory.GetCurrentDirectory())
#if DEBUG
.UseEnvironment(Environment.GetEnvironmentVariable("IMPOSTOR_ENV") ?? "Development")
#else
+++ /dev/null
-using System;
-using System.Diagnostics;
-using System.IO;
-
-namespace Impostor.Server.Utils
-{
- internal static class DirUtils
- {
- // Workaround for:
- // - https://github.com/dotnet/runtime/issues/40828
- // - https://github.com/dotnet/runtime/issues/38405#issuecomment-652643506
- public static string GetExecutableDirectory()
- {
- var programDirectory = Path.GetDirectoryName(typeof(Program).Assembly.Location)!;
- var currentDirectory = Directory.GetCurrentDirectory();
- var baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
- var executablePath = Process.GetCurrentProcess().MainModule!.FileName;
- var executableDirectory = Path.GetDirectoryName(executablePath)!;
- var executable = Path.GetFileNameWithoutExtension(executablePath);
-
- if ("dotnet".Equals(executable, StringComparison.InvariantCultureIgnoreCase))
- {
- return programDirectory;
- }
-
- return executableDirectory;
- }
- }
-}