|
@@ -1,5 +1,4 @@
|
|
|
-using System.Diagnostics;
|
|
|
-using System.IO;
|
|
|
+using System.IO;
|
|
|
using System.Reflection;
|
|
|
|
|
|
namespace BepInEx
|
|
@@ -9,7 +8,23 @@ namespace BepInEx
|
|
|
/// </summary>
|
|
|
public static class Paths
|
|
|
{
|
|
|
- private static string executablePath;
|
|
|
+ internal static void SetExecutablePath(string executablePath)
|
|
|
+ {
|
|
|
+ ExecutablePath = executablePath;
|
|
|
+ ProcessName = Path.GetFileNameWithoutExtension(executablePath);
|
|
|
+ GameRootPath = Path.GetDirectoryName(executablePath);
|
|
|
+ ManagedPath = Utility.CombinePaths(GameRootPath, $"{ProcessName}_Data", "Managed");
|
|
|
+ BepInExRootPath = Utility.CombinePaths(GameRootPath, "BepInEx");
|
|
|
+ PluginPath = Utility.CombinePaths(BepInExRootPath, "plugins");
|
|
|
+ PatcherPluginPath = Utility.CombinePaths(BepInExRootPath, "patchers");
|
|
|
+ BepInExAssemblyDirectory = Utility.CombinePaths(BepInExRootPath, "core");
|
|
|
+ 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.
|
|
@@ -22,24 +37,14 @@ namespace BepInEx
|
|
|
public static string BepInExAssemblyPath { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
|
+ /// The path to the main BepInEx folder.
|
|
|
+ /// </summary>
|
|
|
+ public static string BepInExRootPath { get; private set; }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
/// The path of the currently executing program BepInEx is encapsulated in.
|
|
|
/// </summary>
|
|
|
- public static string ExecutablePath
|
|
|
- {
|
|
|
- get => executablePath;
|
|
|
- internal set
|
|
|
- {
|
|
|
- executablePath = value;
|
|
|
- ProcessName = Path.GetFileNameWithoutExtension(value);
|
|
|
- GameRootPath = Path.GetDirectoryName(value);
|
|
|
- ManagedPath = Utility.CombinePaths(GameRootPath, $"{ProcessName}_Data", "Managed");
|
|
|
- PluginPath = Utility.CombinePaths(GameRootPath, "BepInEx");
|
|
|
- PatcherPluginPath = Utility.CombinePaths(GameRootPath, "BepInEx", "patchers");
|
|
|
- BepInExAssemblyDirectory = Utility.CombinePaths(GameRootPath, "BepInEx", "core");
|
|
|
- BepInExAssemblyPath =
|
|
|
- Utility.CombinePaths(BepInExAssemblyDirectory, $"{Assembly.GetExecutingAssembly().GetName().Name}.dll");
|
|
|
- }
|
|
|
- }
|
|
|
+ public static string ExecutablePath { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
|
/// The directory that the currently executing process resides in.
|
|
@@ -57,7 +62,10 @@ namespace BepInEx
|
|
|
public static string PatcherPluginPath { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
|
- /// The path to the main BepInEx folder.
|
|
|
+ /// 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; }
|
|
|
|