diff --git a/IPA.Loader/Config/SelfConfig.cs b/IPA.Loader/Config/SelfConfig.cs index 2611a6cb..7d21a35e 100644 --- a/IPA.Loader/Config/SelfConfig.cs +++ b/IPA.Loader/Config/SelfConfig.cs @@ -161,5 +161,7 @@ namespace IPA.Config public virtual string LastGameVersion { get; set; } = null; // LINE: ignore public static string LastGameVersion_ => Instance?.LastGameVersion; + + public virtual bool RecursivePluginLoading { get; set; } = false; } } \ No newline at end of file diff --git a/IPA.Loader/Loader/PluginLoader.cs b/IPA.Loader/Loader/PluginLoader.cs index 98e377e8..ffea4205 100644 --- a/IPA.Loader/Loader/PluginLoader.cs +++ b/IPA.Loader/Loader/PluginLoader.cs @@ -70,9 +70,24 @@ namespace IPA.Loader private static readonly Regex embeddedTextDescriptionPattern = new Regex(@"#!\[(.+)\]", RegexOptions.Compiled | RegexOptions.Singleline); + internal static List FindPluginsRecursively(string directory) + { + List dirs = new List(); + foreach (var dir in Directory.GetDirectories(directory)) + { + dirs.AddRange(FindPluginsRecursively(dir)); + } + foreach (var file in Directory.GetFiles(directory, "*.dll")) + { + dirs.Add(file); + } + return dirs; + } + internal static void LoadMetadata() { - string[] plugins = Directory.GetFiles(UnityGame.PluginsPath, "*.dll"); + + string[] plugins = !SelfConfig.Instance.RecursivePluginLoading ? Directory.GetFiles(UnityGame.PluginsPath, "*.dll") : FindPluginsRecursively(UnityGame.PluginsPath).ToArray(); try {