diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-10-10 13:36:11 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-10-10 13:36:11 -0400 |
commit | 474c76183b601dc9ebd238a9acb69cd71f598af0 (patch) | |
tree | 9b3890131cb0b3d12f5f3e46b5a8f08c8c931564 /src/SMAPI.Toolkit | |
parent | 93a748996c1f728a1daafd2e69775c7eeb346b26 (diff) | |
download | SMAPI-474c76183b601dc9ebd238a9acb69cd71f598af0.tar.gz SMAPI-474c76183b601dc9ebd238a9acb69cd71f598af0.tar.bz2 SMAPI-474c76183b601dc9ebd238a9acb69cd71f598af0.zip |
fix error when Steam .vdf file doesn't exist
Diffstat (limited to 'src/SMAPI.Toolkit')
-rw-r--r-- | src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs index 66465ffe..1d518738 100644 --- a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs +++ b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs @@ -264,8 +264,12 @@ namespace StardewModdingAPI.Toolkit.Framework.GameScanning if (steamPath == null) return null; - // get raw .vdf data + // get .vdf file path string libraryFoldersPath = Path.Combine(steamPath.Replace('/', '\\'), "steamapps\\libraryfolders.vdf"); + if (!File.Exists(libraryFoldersPath)) + return null; + + // read data using FileStream fileStream = File.OpenRead(libraryFoldersPath); VdfDeserializer deserializer = new(); dynamic libraries = deserializer.Deserialize(fileStream); |