SDL: filesystem: SDL_SYS_EnumerateDirectory() now returns bool.

From 38f971bac50fd79f0105faa660bbbc4c1a4341ee Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 26 Sep 2024 16:35:15 -0400
Subject: [PATCH] filesystem: SDL_SYS_EnumerateDirectory() now returns bool.

---
 src/filesystem/SDL_filesystem.c       | 5 +----
 src/filesystem/SDL_sysfilesystem.h    | 2 +-
 src/filesystem/dummy/SDL_sysfsops.c   | 5 ++---
 src/filesystem/posix/SDL_sysfsops.c   | 4 ++--
 src/filesystem/windows/SDL_sysfsops.c | 4 ++--
 5 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/src/filesystem/SDL_filesystem.c b/src/filesystem/SDL_filesystem.c
index 69056148ea551..1ceb007f42ceb 100644
--- a/src/filesystem/SDL_filesystem.c
+++ b/src/filesystem/SDL_filesystem.c
@@ -69,10 +69,7 @@ bool SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cal
     } else if (!callback) {
         return SDL_InvalidParamError("callback");
     }
-    if (SDL_SYS_EnumerateDirectory(path, path, callback, userdata) < 0) {
-        return false;
-    }
-    return true;
+    return SDL_SYS_EnumerateDirectory(path, path, callback, userdata);
 }
 
 bool SDL_GetPathInfo(const char *path, SDL_PathInfo *info)
diff --git a/src/filesystem/SDL_sysfilesystem.h b/src/filesystem/SDL_sysfilesystem.h
index c35035bce3030..e0fe9c604bb97 100644
--- a/src/filesystem/SDL_sysfilesystem.h
+++ b/src/filesystem/SDL_sysfilesystem.h
@@ -27,7 +27,7 @@ extern char *SDL_SYS_GetBasePath(void);
 extern char *SDL_SYS_GetPrefPath(const char *org, const char *app);
 extern char *SDL_SYS_GetUserFolder(SDL_Folder folder);
 
-extern int SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata);
+extern bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata);
 extern bool SDL_SYS_RemovePath(const char *path);
 extern bool SDL_SYS_RenamePath(const char *oldpath, const char *newpath);
 extern bool SDL_SYS_CopyFile(const char *oldpath, const char *newpath);
diff --git a/src/filesystem/dummy/SDL_sysfsops.c b/src/filesystem/dummy/SDL_sysfsops.c
index f1acdfd07caf0..a7c40fe0bd589 100644
--- a/src/filesystem/dummy/SDL_sysfsops.c
+++ b/src/filesystem/dummy/SDL_sysfsops.c
@@ -28,10 +28,9 @@
 
 #include "../SDL_sysfilesystem.h"
 
-int SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
+bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
 {
-    SDL_Unsupported();
-    return -1;
+    return SDL_Unsupported();
 }
 
 bool SDL_SYS_RemovePath(const char *path)
diff --git a/src/filesystem/posix/SDL_sysfsops.c b/src/filesystem/posix/SDL_sysfsops.c
index 9b1d963dfb3ba..ff04b2c8bc1bd 100644
--- a/src/filesystem/posix/SDL_sysfsops.c
+++ b/src/filesystem/posix/SDL_sysfsops.c
@@ -34,7 +34,7 @@
 #include <dirent.h>
 #include <sys/stat.h>
 
-int SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
+bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
 {
     int result = 1;
 
@@ -56,7 +56,7 @@ int SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enumer
 
     closedir(dir);
 
-    return result;
+    return (result >= 0);
 }
 
 bool SDL_SYS_RemovePath(const char *path)
diff --git a/src/filesystem/windows/SDL_sysfsops.c b/src/filesystem/windows/SDL_sysfsops.c
index 29aa4e7992a15..743eca681d2d0 100644
--- a/src/filesystem/windows/SDL_sysfsops.c
+++ b/src/filesystem/windows/SDL_sysfsops.c
@@ -29,7 +29,7 @@
 #include "../../core/windows/SDL_windows.h"
 #include "../SDL_sysfilesystem.h"
 
-int SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
+bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
 {
     int result = 1;
     if (*path == '\0') {  // if empty (completely at the root), we need to enumerate drive letters.
@@ -88,7 +88,7 @@ int SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enumer
         FindClose(dir);
     }
 
-    return result;
+    return (result >= 0);
 }
 
 bool SDL_SYS_RemovePath(const char *path)