瀏覽代碼

Add check for missing plugins folder

Bepis 6 年之前
父節點
當前提交
ce4392855a
共有 1 個文件被更改,包括 11 次插入3 次删除
  1. 11 3
      BepInEx/Chainloader.cs

+ 11 - 3
BepInEx/Chainloader.cs

@@ -25,10 +25,18 @@ namespace BepInEx
             UnityInjector.ConsoleUtil.ConsoleWindow.Attach();
             Console.WriteLine("Chainloader started");
 
-            Plugins = LoadTypes<BaseUnityPlugin>(Utility.PluginsDirectory);
+            if (Directory.Exists(Utility.PluginsDirectory))
+            {
+                Plugins = LoadTypes<BaseUnityPlugin>(Utility.PluginsDirectory);
 
-            //UnityInjector.ConsoleUtil.ConsoleEncoding.ConsoleCodePage = 932;
-            Console.WriteLine($"{Plugins.Count()} plugins loaded");
+                //UnityInjector.ConsoleUtil.ConsoleEncoding.ConsoleCodePage = 932;
+                Console.WriteLine($"{Plugins.Count()} plugins loaded");
+            }
+            else
+            {
+                Plugins = new List<Type>();
+                Console.WriteLine("Plugins directory not found, skipping");
+            }
             
             
             ManagerObject = BepInComponent.Create();