fix error when Steam .vdf file doesn't exist
This commit is contained in:
parent
93a748996c
commit
474c76183b
|
@ -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).
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue