Skip to content

Commit

Permalink
fix error when Steam .vdf file doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Oct 10, 2022
1 parent 93a7489 commit 474c761
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
_If needed, you can update to SMAPI 3.16.0 first and then install the latest version._
-->

## Upcoming release
* For players:
* Fixed installer error on Windows if the Steam library folder exists but doesn't contain Steam's `.vdf` library data file.

## 3.17.0
Released 09 October 2022 for Stardew Valley 1.5.6 or later. See [release highlights](https://www.patreon.com/posts/73090322).

Expand Down
6 changes: 5 additions & 1 deletion src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,12 @@ private IEnumerable<string> GetCustomInstallPaths()
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);
Expand Down

0 comments on commit 474c761

Please sign in to comment.