From c76b144b0af05085ec9ab4d09f6125f4978b60e7 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 6 Oct 2022 20:24:41 +1000 Subject: [PATCH 1/2] 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); From 701d00f47311ab8dce0382dd1e648ee00c55e881 Mon Sep 17 00:00:00 2001 From: Luke Date: Fri, 7 Oct 2022 18:21:14 +1000 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f122591..c5b80940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin * SetDefaultsEventArgs now includes a nullable ItemVariant instance. (@SignatureBeef) * Use a string interpolation and escape single quotes when escaping tables (@drunderscore) * Removed obsolete resource files `TShockAPI/Resources.resx` and `TShockAPI/Resources.Designer.cs`. (@Arthri) +* Plugins and ./bin dependencies are now loaded relative to the launcher, this improves the use of startup files (@SignatureBeef) ## TShock 4.5.18 * Fixed `TSPlayer.GiveItem` not working if the player is in lava. (@gohjoseph)