Browse Source

Improved release detection

pull/46/head
Anairkoen Schno 5 years ago
parent
commit
bafee7aa7f
1 changed files with 7 additions and 8 deletions
  1. +7
    -8
      IPA.Loader/Utilities/UnityGame.cs

+ 7
- 8
IPA.Loader/Utilities/UnityGame.cs View File

@ -69,9 +69,9 @@ namespace IPA.Utilities
/// </summary> /// </summary>
Steam, Steam,
/// <summary> /// <summary>
/// Indicates an Oculus release.
/// Indicates a non-Steam release.
/// </summary> /// </summary>
Oculus
Other
} }
private static Release? _releaseCache; private static Release? _releaseCache;
/// <summary> /// <summary>
@ -81,7 +81,7 @@ namespace IPA.Utilities
/// This only gives a /// This only gives a
/// </remarks> /// </remarks>
/// <value>the type of release this is</value> /// <value>the type of release this is</value>
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; private static string _installRoot;
/// <summary> /// <summary>
@ -119,12 +119,11 @@ namespace IPA.Utilities
/// <value>the path to the user data directory</value> /// <value>the path to the user data directory</value>
public static string UserDataPath => Path.Combine(InstallPath, "UserData"); 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";
} }
} }
} }

Loading…
Cancel
Save