From c6f0e9bf5279a48854d5621b88a030a39e3b45b1 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Sun, 28 Mar 2021 18:08:12 -0500 Subject: [PATCH] Add check for files existing before attempting to load plugin --- IPA.Loader/Loader/PluginLoader.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/IPA.Loader/Loader/PluginLoader.cs b/IPA.Loader/Loader/PluginLoader.cs index bed975e9..f4218fe6 100644 --- a/IPA.Loader/Loader/PluginLoader.cs +++ b/IPA.Loader/Loader/PluginLoader.cs @@ -807,6 +807,22 @@ namespace IPA.Loader disabled = false; ignored = false; + // perform file existence check before attempting to load dependencies + foreach (var file in plugin.AssociatedFiles) + { + if (!file.Exists) + { + ignoredPlugins.Add(plugin, new IgnoreReason(Reason.MissingFiles) + { + ReasonText = $"File {Utils.GetRelativePath(file.FullName, UnityGame.InstallPath)} does not exist" + }); + Logger.loader.Warn($"File {Utils.GetRelativePath(file.FullName, UnityGame.InstallPath)}" + + $" (declared by {plugin.Name}) does not exist! Mod installation is incomplete, not loading it."); + ignored = true; + return; + } + } + // TODO: bsipa dependency check // first load dependencies foreach (var dep in plugin.Manifest.Dependencies)