Fix font enumeration

Currently, the font enumeration callback erroneously stops searching if
it finds any files that aren't fonts. In the case that you have, say, a
desktop.ini or a .DS_Store or a license file, it may prevent all of the
fonts from being loaded. This commit resolves this.
This commit is contained in:
Eliza Velasquez 2018-10-07 20:07:58 +00:00 committed by Jonas Kulla
parent ae59fcd112
commit bab22d87be
1 changed files with 2 additions and 2 deletions

View File

@ -469,7 +469,7 @@ fontSetEnumCB (void *data, const char *dir, const char *fname)
const char *ext = findExt(fname); const char *ext = findExt(fname);
if (!ext) if (!ext)
return PHYSFS_ENUM_STOP; return PHYSFS_ENUM_OK;
char lowExt[8]; char lowExt[8];
size_t i; size_t i;
@ -479,7 +479,7 @@ fontSetEnumCB (void *data, const char *dir, const char *fname)
lowExt[i] = '\0'; lowExt[i] = '\0';
if (strcmp(lowExt, "ttf") && strcmp(lowExt, "otf")) if (strcmp(lowExt, "ttf") && strcmp(lowExt, "otf"))
return PHYSFS_ENUM_STOP; return PHYSFS_ENUM_OK;
char filename[512]; char filename[512];
snprintf(filename, sizeof(filename), "%s/%s", dir, fname); snprintf(filename, sizeof(filename), "%s/%s", dir, fname);