Sfoglia il codice sorgente

Allow custom plugin path to be specified

Bepis 6 anni fa
parent
commit
401750e631
2 ha cambiato i file con 10 aggiunte e 0 eliminazioni
  1. 2 0
      BepInEx/Bootstrap/Chainloader.cs
  2. 8 0
      BepInEx/Paths.cs

+ 2 - 0
BepInEx/Bootstrap/Chainloader.cs

@@ -42,6 +42,8 @@ namespace BepInEx.Bootstrap
 			//Set vitals
 			Paths.SetExecutablePath(containerExePath);
 
+			Paths.SetPluginPath(Config.GetEntry("chainloader-plugins-directory", "plugins", "BepInEx"));
+
 			//Start logging
 
 			if (startConsole)

+ 8 - 0
BepInEx/Paths.cs

@@ -21,6 +21,11 @@ namespace BepInEx
 			BepInExAssemblyPath = Utility.CombinePaths(BepInExAssemblyDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.dll");
 		}
 
+		internal static void SetPluginPath(string pluginPath)
+		{
+			PluginPath = Utility.CombinePaths(BepInExRootPath, pluginPath);
+		}
+
         /// <summary>
         ///     The directory that the core BepInEx DLLs reside in.
         /// </summary>
@@ -58,6 +63,9 @@ namespace BepInEx
 
 		/// <summary>
 		///     The path to the plugin folder which resides in the BepInEx folder.
+		/// <para>
+		///		This is ONLY guaranteed to be set correctly when Chainloader has been initialized.
+		/// </para>
 		/// </summary>
 		public static string PluginPath { get; private set; }