- if (ret && cache)
- FcGlobalCacheUpdate (cache, dirs, (char *)dir, tmpSet, config);
+ for (i = 0; i < files->num; i++)
+ FcFileScanConfig (set, dirs, blanks, files->strs[i], config);
+
+ /*
+ * Build the cache object
+ */
+ cache = FcDirCacheBuild (set, dir, 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;
+}