From 1978506112609019d12c65b060ef66591eb0c9dd Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 6 Dec 2025 14:09:58 -0800
Subject: [PATCH] Reverse file iteration in the Steam storage
This prevents us from skipping files if they are deleted from within the callback.
---
src/storage/steam/SDL_steamstorage.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/storage/steam/SDL_steamstorage.c b/src/storage/steam/SDL_steamstorage.c
index 0148e32320f7b..82f8b75a29fad 100644
--- a/src/storage/steam/SDL_steamstorage.c
+++ b/src/storage/steam/SDL_steamstorage.c
@@ -105,7 +105,7 @@ static bool STEAM_EnumerateStorageDirectory(void *userdata, const char *path, SD
bool done = false;
Sint32 count = steam->SteamAPI_ISteamRemoteStorage_GetFileCount(steamremotestorage);
- for (Sint32 i = 0; i < count && !done; ++i) {
+ for (Sint32 i = count; i-- && !done; ) {
const char *file = steam->SteamAPI_ISteamRemoteStorage_GetFileNameAndSize(steamremotestorage, i, NULL);
if (!file) {
continue;