filesystem: Added SDL_GlobDirectory() and SDL_GlobStorageDirectory().

Fixes #9287.
This commit is contained in:
Ryan C. Gordon
2024-03-18 15:32:04 -04:00
parent 810656962c
commit 764207d873
9 changed files with 398 additions and 2 deletions

View File

@@ -110,10 +110,23 @@ int main(int argc, char *argv[])
}
if (base_path) {
char **globlist;
if (SDL_EnumerateDirectory(base_path, enum_callback, NULL) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Base path enumeration failed!");
}
globlist = SDL_GlobDirectory(base_path, "*/test*/Test*", SDL_GLOBDIR_CASEINSENSITIVE, NULL);
if (!globlist) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Base path globbing failed!");
} else {
int i;
for (i = 0; globlist[i]; i++) {
SDL_Log("GLOB[%d]: '%s'", i, globlist[i]);
}
SDL_free(globlist);
}
/* !!! FIXME: put this in a subroutine and make it test more thoroughly (and put it in testautomation). */
if (SDL_CreateDirectory("testfilesystem-test") == -1) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_CreateDirectory('testfilesystem-test') failed: %s", SDL_GetError());