mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-01 15:38:29 +00:00
filesystem: SDL_SYS_EnumerateDirectory inexplicably takes the same arg twice.
This commit is contained in:
@@ -121,7 +121,7 @@ bool SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cal
|
|||||||
} else if (!callback) {
|
} else if (!callback) {
|
||||||
return SDL_InvalidParamError("callback");
|
return SDL_InvalidParamError("callback");
|
||||||
}
|
}
|
||||||
return SDL_SYS_EnumerateDirectory(path, path, callback, userdata);
|
return SDL_SYS_EnumerateDirectory(path, callback, userdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SDL_GetPathInfo(const char *path, SDL_PathInfo *info)
|
bool SDL_GetPathInfo(const char *path, SDL_PathInfo *info)
|
||||||
|
@@ -28,7 +28,7 @@ extern char *SDL_SYS_GetPrefPath(const char *org, const char *app);
|
|||||||
extern char *SDL_SYS_GetUserFolder(SDL_Folder folder);
|
extern char *SDL_SYS_GetUserFolder(SDL_Folder folder);
|
||||||
extern char *SDL_SYS_GetCurrentDirectory(void);
|
extern char *SDL_SYS_GetCurrentDirectory(void);
|
||||||
|
|
||||||
extern bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata);
|
extern bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata);
|
||||||
extern bool SDL_SYS_RemovePath(const char *path);
|
extern bool SDL_SYS_RemovePath(const char *path);
|
||||||
extern bool SDL_SYS_RenamePath(const char *oldpath, const char *newpath);
|
extern bool SDL_SYS_RenamePath(const char *oldpath, const char *newpath);
|
||||||
extern bool SDL_SYS_CopyFile(const char *oldpath, const char *newpath);
|
extern bool SDL_SYS_CopyFile(const char *oldpath, const char *newpath);
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "../SDL_sysfilesystem.h"
|
#include "../SDL_sysfilesystem.h"
|
||||||
|
|
||||||
bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
|
bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata)
|
||||||
{
|
{
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
|
bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata)
|
||||||
{
|
{
|
||||||
SDL_EnumerationResult result = SDL_ENUM_CONTINUE;
|
SDL_EnumerationResult result = SDL_ENUM_CONTINUE;
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enume
|
|||||||
if ((SDL_strcmp(name, ".") == 0) || (SDL_strcmp(name, "..") == 0)) {
|
if ((SDL_strcmp(name, ".") == 0) || (SDL_strcmp(name, "..") == 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
result = cb(userdata, dirname, name);
|
result = cb(userdata, path, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include "../../core/windows/SDL_windows.h"
|
#include "../../core/windows/SDL_windows.h"
|
||||||
#include "../SDL_sysfilesystem.h"
|
#include "../SDL_sysfilesystem.h"
|
||||||
|
|
||||||
bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_EnumerateDirectoryCallback cb, void *userdata)
|
bool SDL_SYS_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback cb, void *userdata)
|
||||||
{
|
{
|
||||||
SDL_EnumerationResult result = SDL_ENUM_CONTINUE;
|
SDL_EnumerationResult result = SDL_ENUM_CONTINUE;
|
||||||
if (*path == '\0') { // if empty (completely at the root), we need to enumerate drive letters.
|
if (*path == '\0') { // if empty (completely at the root), we need to enumerate drive letters.
|
||||||
@@ -38,7 +38,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enume
|
|||||||
for (int i = 'A'; (result == SDL_ENUM_CONTINUE) && (i <= 'Z'); i++) {
|
for (int i = 'A'; (result == SDL_ENUM_CONTINUE) && (i <= 'Z'); i++) {
|
||||||
if (drives & (1 << (i - 'A'))) {
|
if (drives & (1 << (i - 'A'))) {
|
||||||
name[0] = (char) i;
|
name[0] = (char) i;
|
||||||
result = cb(userdata, dirname, name);
|
result = cb(userdata, path, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -79,7 +79,7 @@ bool SDL_SYS_EnumerateDirectory(const char *path, const char *dirname, SDL_Enume
|
|||||||
if (!utf8fn) {
|
if (!utf8fn) {
|
||||||
result = SDL_ENUM_FAILURE;
|
result = SDL_ENUM_FAILURE;
|
||||||
} else {
|
} else {
|
||||||
result = cb(userdata, dirname, utf8fn);
|
result = cb(userdata, path, utf8fn);
|
||||||
SDL_free(utf8fn);
|
SDL_free(utf8fn);
|
||||||
}
|
}
|
||||||
} while ((result == SDL_ENUM_CONTINUE) && (FindNextFileW(dir, &entw) != 0));
|
} while ((result == SDL_ENUM_CONTINUE) && (FindNextFileW(dir, &entw) != 0));
|
||||||
|
Reference in New Issue
Block a user