From 3a5838c8f5a24bbe198faa41574736694848992e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 1 May 2024 12:20:06 +0200 Subject: [PATCH] don't abort when parsing the Steam config fails. --- src/win32/i_steam.cpp | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/src/win32/i_steam.cpp b/src/win32/i_steam.cpp index f8bd74bff1..2cf536475a 100644 --- a/src/win32/i_steam.cpp +++ b/src/win32/i_steam.cpp @@ -61,6 +61,7 @@ #include "printf.h" +#include "engineerrors.h" #include "version.h" #include "i_sound.h" #include "stats.h" @@ -307,22 +308,29 @@ TArray I_GetSteamPath() return result; } - TArray paths = ParseSteamRegistry((steamPath + "/config/libraryfolders.vdf").GetChars()); - - for(FString &path : paths) + try { - path.ReplaceChars('\\','/'); - path+="/"; - } + TArray paths = ParseSteamRegistry((steamPath + "/config/libraryfolders.vdf").GetChars()); - paths.Push(steamPath + "/steamapps/common/"); - - for(unsigned int i = 0; i < countof(steam_dirs); ++i) - { - for(const FString &path : paths) + for (FString& path : paths) { - result.Push(path + steam_dirs[i]); + path.ReplaceChars('\\', '/'); + path += "/"; } + + paths.Push(steamPath + "/steamapps/common/"); + + for (unsigned int i = 0; i < countof(steam_dirs); ++i) + { + for (const FString& path : paths) + { + result.Push(path + steam_dirs[i]); + } + } + } + catch (const CRecoverableError& err) + { + // don't abort on errors in here. Just return an empty path. } return result;