Fix filepaths added when scanning with sysroot
This fixes a regression introduced by 76f88e780
. When
using FONTCONFIG_SYSROOT=/home/tom/test_fonts, strace
reveals that fontconfig attempted to open /test_fonts/Ahem.ttf
instead of /home/tom/test_fonts/Ahem.ttf. The fix is to use
`s_dir` instead of `dir` in `file_prefix`.
This commit is contained in:
parent
311f6caaa8
commit
2ef790a0db
22
src/fcdir.c
22
src/fcdir.c
|
@ -201,7 +201,7 @@ FcDirScanConfig (FcFontSet *set,
|
||||||
DIR *d;
|
DIR *d;
|
||||||
struct dirent *e;
|
struct dirent *e;
|
||||||
FcStrSet *files;
|
FcStrSet *files;
|
||||||
FcChar8 *file_prefix, *s_dir = NULL;
|
FcChar8 *file_prefix = NULL, *s_dir = NULL;
|
||||||
FcChar8 *base;
|
FcChar8 *base;
|
||||||
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
|
const FcChar8 *sysroot = FcConfigGetSysRoot (config);
|
||||||
FcBool ret = FcTrue;
|
FcBool ret = FcTrue;
|
||||||
|
@ -213,16 +213,6 @@ FcDirScanConfig (FcFontSet *set,
|
||||||
if (!set && !dirs)
|
if (!set && !dirs)
|
||||||
return FcTrue;
|
return FcTrue;
|
||||||
|
|
||||||
/* freed below */
|
|
||||||
file_prefix = (FcChar8 *) malloc (strlen ((char *) dir) + 1 + FC_MAX_FILE_LEN + 1);
|
|
||||||
if (!file_prefix) {
|
|
||||||
ret = FcFalse;
|
|
||||||
goto bail;
|
|
||||||
}
|
|
||||||
strcpy ((char *) file_prefix, (char *) dir);
|
|
||||||
strcat ((char *) file_prefix, FC_DIR_SEPARATOR_S);
|
|
||||||
base = file_prefix + strlen ((char *) file_prefix);
|
|
||||||
|
|
||||||
if (sysroot)
|
if (sysroot)
|
||||||
s_dir = FcStrBuildFilename (sysroot, dir, NULL);
|
s_dir = FcStrBuildFilename (sysroot, dir, NULL);
|
||||||
else
|
else
|
||||||
|
@ -232,6 +222,16 @@ FcDirScanConfig (FcFontSet *set,
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* freed below */
|
||||||
|
file_prefix = (FcChar8 *) malloc (strlen ((char *) s_dir) + 1 + FC_MAX_FILE_LEN + 1);
|
||||||
|
if (!file_prefix) {
|
||||||
|
ret = FcFalse;
|
||||||
|
goto bail;
|
||||||
|
}
|
||||||
|
strcpy ((char *) file_prefix, (char *) s_dir);
|
||||||
|
strcat ((char *) file_prefix, FC_DIR_SEPARATOR_S);
|
||||||
|
base = file_prefix + strlen ((char *) file_prefix);
|
||||||
|
|
||||||
if (FcDebug () & FC_DBG_SCAN)
|
if (FcDebug () & FC_DBG_SCAN)
|
||||||
printf ("\tScanning dir %s\n", s_dir);
|
printf ("\tScanning dir %s\n", s_dir);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue