diff --git a/ModTekPreloader/Injector/AssemblyCache.cs b/ModTekPreloader/Injector/AssemblyCache.cs index 42978df..e5f1ac0 100644 --- a/ModTekPreloader/Injector/AssemblyCache.cs +++ b/ModTekPreloader/Injector/AssemblyCache.cs @@ -16,10 +16,14 @@ internal AssemblyCache() { searchDirectories = new List { - Paths.AssembliesOverrideDirectory, Paths.ModTekDirectory, Paths.ManagedDirectory }; + + if (Directory.Exists(Paths.AssembliesOverrideDirectory)) + { + searchDirectories.Insert(0, Paths.AssembliesOverrideDirectory); + } } public AssemblyDefinition Resolve(AssemblyNameReference name) diff --git a/ModTekPreloader/Loader/Preloader.cs b/ModTekPreloader/Loader/Preloader.cs index 6a2e6f7..3728be5 100644 --- a/ModTekPreloader/Loader/Preloader.cs +++ b/ModTekPreloader/Loader/Preloader.cs @@ -48,6 +48,11 @@ private static void PreloadAssembliesInjected() private static void PreloadAssembliesOverride() { + if (!Directory.Exists(Paths.AssembliesOverrideDirectory)) + { + return; + } + Logger.Main.Log($"Preloading override assemblies from `{Paths.GetRelativePath(Paths.AssembliesOverrideDirectory)}`:"); foreach (var file in Directory.GetFiles(Paths.AssembliesOverrideDirectory, "*.dll").OrderBy(p => p)) {