From 3957f87103f1fc8b66164cda6041b06713e114fb Mon Sep 17 00:00:00 2001 From: AlexZ Date: Fri, 29 May 2020 23:15:31 +0300 Subject: [PATCH] Update SteamPathsUtil.cs * fix read steam config --- src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs b/src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs index 793e82e..74a148d 100644 --- a/src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs +++ b/src/EpicMorg.SteamPathsLib/SteamPathsUtil.cs @@ -85,15 +85,18 @@ libraryPaths.Add(Path.Combine(steamPath, "steamapps")); - dynamic configObject = VdfConvert.Deserialize(File.ReadAllText(configPath)).Value; - var configLibraryPaths = ((VObject)configObject.Software.Valve.Steam) - .Children() - .Where(item => item.Key.StartsWith("BaseInstallFolder")) - .Select(item => item.Value.ToString()) - .Select(line => new DirectoryInfo(line).FullName) - .Select(line => Path.Combine(line, "steamapps")); + try { + dynamic configObject = VdfConvert.Deserialize(File.ReadAllText(configPath)).Value; + var valve = configObject.Software.Valve ?? configObject.Software.valve; + var configLibraryPaths = ((VObject)valve.Steam) + .Children() + .Where(item => item.Key.StartsWith("BaseInstallFolder")) + .Select(item => item.Value.ToString()) + .Select(line => new DirectoryInfo(line).FullName) + .Select(line => Path.Combine(line, "steamapps")); - libraryPaths.AddRange(configLibraryPaths); + libraryPaths.AddRange(configLibraryPaths); + } catch { } result.SteamLibraryFolders = libraryPaths.ToArray();