+
+bail2:
+ FcStrSetDestroy (files);
+bail1:
+ closedir (d);
+bail:
+ return ret;
+}
+
+FcBool
+FcDirScan (FcFontSet *set,
+ FcStrSet *dirs,
+ FcFileCache *cache, /* XXX unused */
+ FcBlanks *blanks,
+ const FcChar8 *dir,
+ FcBool force /* XXX unused */)
+{
+ if (cache || !force)
+ return FcFalse;
+
+ return FcDirScanConfig (set, dirs, blanks, dir, force, FcConfigGetCurrent ());
+}
+
+/*
+ * Scan the specified directory and construct a cache of its contents
+ */
+FcCache *
+FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
+{
+ FcStrSet *dirs;
+ FcBool ret = FcTrue;
+ FcFontSet *set;
+ FcCache *cache = NULL;
+ struct stat dir_stat;
+
+ if (FcDebug () & FC_DBG_FONTSET)
+ printf ("cache scan dir %s\n", dir);
+
+ if (FcStat (dir, &dir_stat) < 0)
+ {
+ if (errno != ENOENT)
+ ret = FcFalse;
+ goto bail;
+ }
+
+ set = FcFontSetCreate();
+ if (!set)
+ {
+ ret = FcFalse;
+ goto bail;
+ }
+
+ dirs = FcStrSetCreate ();
+ if (!dirs)
+ {
+ ret = FcFalse;
+ goto bail1;
+ }
+
+ /*
+ * Scan the dir
+ */
+ if (!FcDirScanConfig (set, dirs, NULL, dir, FcTrue, config))
+ {
+ ret = FcFalse;
+ goto bail2;
+ }
+