From bafee7aa7ff7012f5bde01fc2f6aa79ac4d0a573 Mon Sep 17 00:00:00 2001 From: Anairkoen Schno Date: Fri, 10 Jan 2020 21:38:35 -0600 Subject: [PATCH] Improved release detection --- IPA.Loader/Utilities/UnityGame.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/IPA.Loader/Utilities/UnityGame.cs b/IPA.Loader/Utilities/UnityGame.cs index ab9f4267..cdd26f31 100644 --- a/IPA.Loader/Utilities/UnityGame.cs +++ b/IPA.Loader/Utilities/UnityGame.cs @@ -69,9 +69,9 @@ namespace IPA.Utilities /// Steam, /// - /// Indicates an Oculus release. + /// Indicates a non-Steam release. /// - Oculus + Other } private static Release? _releaseCache; /// @@ -81,7 +81,7 @@ namespace IPA.Utilities /// This only gives a /// /// the type of release this is - public static Release ReleaseType => (_releaseCache ?? (_releaseCache = FindSteamVRAsset() ? Release.Steam : Release.Oculus)).Value; + public static Release ReleaseType => (_releaseCache ?? (_releaseCache = CheckIsSteam() ? Release.Steam : Release.Other)).Value; private static string _installRoot; /// @@ -119,12 +119,11 @@ namespace IPA.Utilities /// the path to the user data directory public static string UserDataPath => Path.Combine(InstallPath, "UserData"); - private static bool FindSteamVRAsset() + private static bool CheckIsSteam() { - // TODO: fix this so that it works more consistently and generally - var steamUser = Type.GetType("Steamworks.SteamUser, Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", false); - - return steamUser != null; + var installDirInfo = new DirectoryInfo(InstallPath); + return installDirInfo.Parent?.Name == "common" + && installDirInfo.Parent?.Parent?.Name == "steamapps"; } } }