Fix font search on Android

This commit is contained in:
RadialApps 2017-08-12 17:25:45 +05:30
parent d7c9dfe2de
commit 84226422b5
1 changed files with 4 additions and 4 deletions

View File

@ -496,18 +496,18 @@ static void fontSetEnumCB(void *data, const char *dir,
} }
/* Basically just a case-insensitive search /* Basically just a case-insensitive search
* for the folder "Fonts"... */ * for all folders starting with "Fonts"... */
static void findFontsFolderCB(void *data, const char *, static void findFontsFolderCB(void *data, const char *,
const char *fname) const char *fname)
{ {
size_t i = 0; size_t i = 0;
char buffer[512]; char buffer[6];
const char *s = fname; const char *s = fname;
while (s && i < sizeof(buffer)) while (s && i < sizeof(buffer))
buffer[i++] = tolower(*s++); buffer[i++] = tolower(*s++);
buffer[i] = '\0'; buffer[5] = '\0';
if (strcmp(buffer, "fonts") == 0) if (strcmp(buffer, "fonts") == 0)
PHYSFS_enumerateFilesCallback(fname, fontSetEnumCB, data); PHYSFS_enumerateFilesCallback(fname, fontSetEnumCB, data);
@ -517,7 +517,7 @@ void FileSystem::initFontSets(SharedFontState &sfs)
{ {
FontSetsCBData d = { p, &sfs }; FontSetsCBData d = { p, &sfs };
PHYSFS_enumerateFilesCallback(".", findFontsFolderCB, &d); PHYSFS_enumerateFilesCallback("", findFontsFolderCB, &d);
} }
struct OpenReadEnumData struct OpenReadEnumData