Skip to content

Commit

Permalink
don't abort when parsing the Steam config fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed May 1, 2024
1 parent 6f2bc83 commit 3a5838c
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/win32/i_steam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@

#include "printf.h"

#include "engineerrors.h"
#include "version.h"
#include "i_sound.h"
#include "stats.h"
Expand Down Expand Up @@ -307,23 +308,30 @@ TArray<FString> I_GetSteamPath()
return result;
}

TArray<FString> paths = ParseSteamRegistry((steamPath + "/config/libraryfolders.vdf").GetChars());

for(FString &path : paths)
try
{
path.ReplaceChars('\\','/');
path+="/";
}
TArray<FString> paths = ParseSteamRegistry((steamPath + "/config/libraryfolders.vdf").GetChars());

paths.Push(steamPath + "/steamapps/common/");
for (FString& path : paths)
{
path.ReplaceChars('\\', '/');
path += "/";
}

for(unsigned int i = 0; i < countof(steam_dirs); ++i)
{
for(const FString &path : paths)
paths.Push(steamPath + "/steamapps/common/");

for (unsigned int i = 0; i < countof(steam_dirs); ++i)
{
result.Push(path + 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;
}
Expand Down

0 comments on commit 3a5838c

Please sign in to comment.