Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
Merge pull request #54 from beat-saber-modding-group/oculus-path-dete…
Browse files Browse the repository at this point in the history
…ct-fix

Fix Oculus path detect Linq error
  • Loading branch information
megalon authored May 12, 2019
2 parents 5c49927 + 82352b5 commit ec1f44e
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions BeatSaberModManager/Core/PathLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,19 @@ private string GetValidOculusLocation()
{
using (RegistryKey libraryKey = librariesKey.OpenSubKey(libraryKeyName))
{
string libraryPath = (string) libraryKey.GetValue("Path");
folderPath = Path.Combine(guidLetterVolumes.First(x => libraryPath.Contains(x.Key)).Value, libraryPath.Substring(49), subFolderPath);
fullAppPath = Path.Combine(folderPath, AppFileName);
string libraryPath = (string)libraryKey.GetValue("Path");

if (File.Exists(fullAppPath))
// Apparently this can be null
var guidLetter = guidLetterVolumes.FirstOrDefault(x => libraryPath.Contains(x.Key)).Value;
if (guidLetter != null)
{
return folderPath;
folderPath = Path.Combine(guidLetter, libraryPath.Substring(49), subFolderPath);
fullAppPath = Path.Combine(folderPath, AppFileName);

if (File.Exists(fullAppPath))
{
return folderPath;
}
}
}
}
Expand Down

0 comments on commit ec1f44e

Please sign in to comment.