浏览代码

Read Managed folder path from Doorstop

ghorsington 5 年之前
父节点
当前提交
c8118efcc0
共有 3 个文件被更改,包括 11 次插入2 次删除
  1. 2 0
      BepInEx.Preloader/Entrypoint.cs
  2. 2 2
      BepInEx/Bootstrap/Chainloader.cs
  3. 7 0
      BepInEx/Paths.cs

+ 2 - 0
BepInEx.Preloader/Entrypoint.cs

@@ -10,6 +10,8 @@ namespace BepInEx.Preloader
 		public static void PreloaderMain(string[] args)
 		{
 			Paths.SetExecutablePath(args[0]);
+			Paths.SetManagedPath(Environment.GetEnvironmentVariable("DOORSTOP_MANAGED_FOLDER_DIR"));
+
 			AppDomain.CurrentDomain.AssemblyResolve += LocalResolve;
 			Preloader.Run();
 		}

+ 2 - 2
BepInEx/Bootstrap/Chainloader.cs

@@ -39,14 +39,14 @@ namespace BepInEx.Bootstrap
 		/// <summary>
         /// Initializes BepInEx to be able to start the chainloader.
         /// </summary>
-        public static void Initialize(string containerExePath, bool startConsole = true)
+        public static void Initialize(string containerExePath, string managedPath = null, bool startConsole = true)
 		{
 			if (_initialized)
 				return;
 
 			//Set vitals
 			Paths.SetExecutablePath(containerExePath);
-
+			Paths.SetManagedPath(managedPath);
 			Paths.SetPluginPath(ConfigPluginsDirectory.Value);
 
             //Start logging

+ 7 - 0
BepInEx/Paths.cs

@@ -23,6 +23,13 @@ namespace BepInEx
 			BepInExAssemblyPath = Path.Combine(BepInExAssemblyDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.dll");
 		}
 
+		internal static void SetManagedPath(string managedPath)
+		{
+			if (managedPath == null)
+				return;
+			ManagedPath = managedPath;
+		}
+
 		internal static void SetPluginPath(string pluginPath)
 		{
 			PluginPath = Utility.CombinePaths(BepInExRootPath, pluginPath);