Browse Source

Add check for missing plugins folder

Bepis 6 years ago
parent
commit
ce4392855a
1 changed files with 11 additions and 3 deletions
  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();