Переглянути джерело

Read Managed folder path from Doorstop

ghorsington 5 роки тому
батько
коміт
c8118efcc0

+ 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);