Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

Commit

Permalink
Fix for games installed in another library folder
Browse files Browse the repository at this point in the history
  • Loading branch information
nrgill28 committed Jun 14, 2021
1 parent 767934a commit dff75c2
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions DeliCounter/Backend/Services/SteamAppLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;

namespace DeliCounter.Backend
{
Expand Down Expand Up @@ -78,17 +79,15 @@ public void Locate()
{
// We didn't find it, look at other library folders by lazily parsing libraryfolders.
var libraryFolders = Path.Combine(steamDir, @"steamapps\libraryfolders.vdf");
foreach (var ii in File.ReadAllLines(libraryFolders).Skip(4)
.Where(x => x.Length != 0 && x[0] != '}')
.Select(x => x.Split('\t')[3].Trim('"').Replace(@"\\", @"\")).Where(ii =>
File.Exists(ii + $@"\steamapps\appmanifest_{AppId}.acf")))
foreach (Match match in Regex.Matches(File.ReadAllText(libraryFolders), @"^\s+\""path\""\s+\""(.+)\""$", RegexOptions.Multiline))
{
result = Path.Combine(ii, $@"steamapps\common\{AppFolderName}\");
break;
var folder = match.Groups[1].Value;
if (!File.Exists(Path.Combine(folder, $"steamapps/appmanifest_{AppId}.acf"))) continue;
result = Path.Combine(folder, $"steamapps/common/{AppFolderName}");
}
}

AppLocation = string.IsNullOrEmpty(result) ? null : result;
AppLocation = string.IsNullOrEmpty(result) ? null : Path.GetFullPath(result);
}
}
}

0 comments on commit dff75c2

Please sign in to comment.