Fixed imlib_list_fonts()

It was calling stat on filenames without paths, so that was failing.


SVN revision: 3064
This commit is contained in:
Tom Gilbert 2000-08-07 21:39:35 +00:00
parent c465599b95
commit b257c14d76
1 changed files with 5 additions and 7 deletions

View File

@ -775,17 +775,14 @@ __imlib_list_fonts(int *num_ret)
if (dir) if (dir)
{ {
for (j = 0; j < d; j++) for (j = 0; j < d; j++)
{ {
if (__imlib_FileIsFile(dir[j])) path = malloc(strlen(fpath[i]) + strlen(dir[j]) + 2);
sprintf(path, "%s/%s", fpath[i], dir[j]);
if (__imlib_FileIsFile(path))
{ {
TT_Face f; TT_Face f;
path = malloc(strlen(fpath[i]) + 1 + strlen(dir[j]) + 1);
strcpy(path, fpath[i]);
strcat(path, "/");
strcat(path, dir[j]);
error = TT_Open_Face(engine, path, &f); error = TT_Open_Face(engine, path, &f);
free(path);
if (!error) if (!error)
{ {
TT_Close_Face(f); TT_Close_Face(f);
@ -798,6 +795,7 @@ __imlib_list_fonts(int *num_ret)
} }
free(dir[j]); free(dir[j]);
} }
free(path);
} }
free(dir); free(dir);
} }