From c76b144b0af05085ec9ab4d09f6125f4978b60e7 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 6 Oct 2022 20:24:41 +1000 Subject: [PATCH] Fix #2674 - Change the use of current directory to match the server assembly location This will allow dependencies to be resolved beside the assembly as intended when startup scripts are used outside the working directory. I am not sure why or how many people would do this, as TSAPI wont load plugins (existing issue), but this is a step in the direction of opening up to allow considerations for that. --- TShockLauncher/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockLauncher/Program.cs b/TShockLauncher/Program.cs index 0410f341..1f47c837 100644 --- a/TShockLauncher/Program.cs +++ b/TShockLauncher/Program.cs @@ -42,7 +42,7 @@ Assembly? Default_Resolving(System.Runtime.Loader.AssemblyLoadContext arg1, Asse if (arg2?.Name is null) return null; if (_cache.TryGetValue(arg2.Name, out Assembly? asm) && asm is not null) return asm; - var loc = Path.Combine(Environment.CurrentDirectory, "bin", arg2.Name + ".dll"); + var loc = Path.Combine(AppContext.BaseDirectory, "bin", arg2.Name + ".dll"); if (File.Exists(loc)) asm = arg1.LoadFromAssemblyPath(loc);