summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-07-08 19:02:33 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-07-08 19:02:33 -0400
commit1b3a1a48d0d0d7e2423db54f3266cabd80a5a9b3 (patch)
tree0ab2be11bc7ad204230d69fa93ab83cfe21b905d /src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
parent0c0f7898f4ff3b2e4afdbdc438674b30be7dacc7 (diff)
downloadSMAPI-1b3a1a48d0d0d7e2423db54f3266cabd80a5a9b3.tar.gz
SMAPI-1b3a1a48d0d0d7e2423db54f3266cabd80a5a9b3.tar.bz2
SMAPI-1b3a1a48d0d0d7e2423db54f3266cabd80a5a9b3.zip
refactor assembly resolver to avoid repeatedly copying search directory list
Diffstat (limited to 'src/SMAPI/Framework/ModLoading/AssemblyLoader.cs')
-rw-r--r--src/SMAPI/Framework/ModLoading/AssemblyLoader.cs5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
index bd29a159..01037870 100644
--- a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
+++ b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs
@@ -267,11 +267,8 @@ namespace StardewModdingAPI.Framework.ModLoading
// add the assembly's directory temporarily if needed
// this is needed by F# mods which bundle FSharp.Core.dll, for example
string? temporarySearchDir = null;
- if (file.DirectoryName is not null && !this.AssemblyDefinitionResolver.GetSearchDirectories().Contains(file.DirectoryName))
- {
- this.AssemblyDefinitionResolver.AddSearchDirectory(file.DirectoryName);
+ if (this.AssemblyDefinitionResolver.TryAddSearchDirectory(file.DirectoryName))
temporarySearchDir = file.DirectoryName;
- }
// read assembly
AssemblyDefinition assembly;