mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2024-11-27 03:50:25 +00:00
filesystem: SDL_SYS_EnumerateDirectory() now returns bool.
This commit is contained in:
parent
86ea283904
commit
38f971bac5
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user