+ qsort(files->strs, files->num, sizeof(FcChar8 *), cmpstringp);
+
+ dirs = FcStrSetCreate ();
+ if (!dirs)
+ goto bail2;
+
+ /*
+ * Scan file files to build font patterns
+ */
+ for (i = 0; i < files->num; i++)
+ FcFileScanConfig (set, dirs, blanks, files->strs[i], config);
+
+ /*
+ * Build the cache object
+ */
+ cache = FcDirCacheBuild (set, dir, &dir_stat, dirs);
+ if (!cache)
+ goto bail3;
+
+ /*
+ * Write out the cache file, ignoring any troubles
+ */
+ FcDirCacheWrite (cache, config);
+
+ bail3:
+ FcStrSetDestroy (dirs);
+ bail2:
+ FcStrSetDestroy (files);
+ bail1:
+ FcFontSetDestroy (set);
+
+ bail0:
+ closedir (d);
+
+ bail_1:
+ free (file);
+ bail:
+ return cache;
+}
+
+/*
+ * Read (or construct) the cache for a directory
+ */
+FcCache *
+FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config)
+{
+ FcCache *cache = NULL;
+
+ if (config && !FcConfigAcceptFilename (config, dir))
+ return NULL;
+
+ /* Try to use existing cache file */
+ if (!force)
+ cache = FcDirCacheLoad (dir, config, NULL);
+
+ /* Not using existing cache file, construct new cache */
+ if (!cache)
+ cache = FcDirCacheScan (dir, config);
+
+ return cache;
+}
+
+FcBool
+FcDirScanConfig (FcFontSet *set,
+ FcStrSet *dirs,
+ FcBlanks *blanks,
+ const FcChar8 *dir,
+ FcBool force,
+ FcConfig *config)
+{
+ return FcFalse; /* XXX deprecated */