diff --git a/Doorstop b/Doorstop
index 37db1fce..0f76cf26 160000
--- a/Doorstop
+++ b/Doorstop
@@ -1 +1 @@
-Subproject commit 37db1fce3e2f398c2e181fe5e1135bc0637125ec
+Subproject commit 0f76cf26a2f84c6cd82a1c7a1d773c10be6ba233
diff --git a/IPA.Injector/Injector.cs b/IPA.Injector/Injector.cs
index d3b5a928..cef45ff4 100644
--- a/IPA.Injector/Injector.cs
+++ b/IPA.Injector/Injector.cs
@@ -85,9 +85,13 @@ namespace IPA.Injector
private static void InstallBootstrapPatch()
{
var cAsmName = Assembly.GetExecutingAssembly().GetName();
+ var managedPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+
+ var dataDir = new DirectoryInfo(managedPath).Parent.Name;
+ var gameName = dataDir.Substring(0, dataDir.Length - 5);
loader.Debug("Finding backup");
- var backupPath = Path.Combine(Environment.CurrentDirectory, "IPA", "Backups", "Beat Saber");
+ var backupPath = Path.Combine(Environment.CurrentDirectory, "IPA", "Backups", gameName);
var bkp = BackupManager.FindLatestBackup(backupPath);
if (bkp == null)
loader.Warn("No backup found! Was BSIPA installed using the installer?");
@@ -97,7 +101,7 @@ namespace IPA.Injector
#region Insert patch into UnityEngine.CoreModule.dll
{
- var unityPath = Path.Combine(Environment.CurrentDirectory, "Beat Saber_Data", "Managed",
+ var unityPath = Path.Combine(managedPath,
"UnityEngine.CoreModule.dll");
var unityAsmDef = AssemblyDefinition.ReadAssembly(unityPath, new ReaderParameters
@@ -188,7 +192,7 @@ namespace IPA.Injector
loader.Debug("Ensuring Assembly-CSharp is virtualized");
{
- var ascPath = Path.Combine(Environment.CurrentDirectory, "Beat Saber_Data", "Managed",
+ var ascPath = Path.Combine(managedPath,
"Assembly-CSharp.dll");
#region Virtualize Assembly-CSharp.dll
diff --git a/IPA.Loader/Utilities/BeatSaber.cs b/IPA.Loader/Utilities/BeatSaber.cs
index 18f39990..35d0cc57 100644
--- a/IPA.Loader/Utilities/BeatSaber.cs
+++ b/IPA.Loader/Utilities/BeatSaber.cs
@@ -1,5 +1,6 @@
using System;
using System.IO;
+using System.Reflection;
using UnityEngine;
using Version = SemVer.Version;
@@ -36,10 +37,20 @@ namespace IPA.Utilities
///
public static Release ReleaseType => (_releaseCache ?? (_releaseCache = FindSteamVRAsset() ? Release.Steam : Release.Oculus)).Value;
+ private static string _installRoot;
///
/// The path to the Beat Saber install dir
///
- public static string InstallPath => Environment.CurrentDirectory;
+ public static string InstallPath
+ {
+ get
+ {
+ if (_installRoot == null)
+ _installRoot = Path.GetFullPath(
+ Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..", ".."));
+ return _installRoot;
+ }
+ }
///
/// The path to the `Libs` folder. Use only if necessary.
///