aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/src/fcdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fontconfig/src/fcdir.c')
-rw-r--r--fontconfig/src/fcdir.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/fontconfig/src/fcdir.c b/fontconfig/src/fcdir.c
index b040a285a..3bcd0b867 100644
--- a/fontconfig/src/fcdir.c
+++ b/fontconfig/src/fcdir.c
@@ -130,7 +130,12 @@ FcFileScanConfig (FcFontSet *set,
if (FcFileIsDir (file))
return FcStrSetAdd (dirs, file);
else
- return FcFileScanFontConfig (set, blanks, file, config);
+ {
+ if (set)
+ return FcFileScanFontConfig (set, blanks, file, config);
+ else
+ return FcTrue;
+ }
}
FcBool
@@ -306,6 +311,45 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
return cache;
}
+FcCache *
+FcDirCacheRescan (const FcChar8 *dir, FcConfig *config)
+{
+ FcCache *cache = FcDirCacheLoad (dir, config, NULL);
+ FcCache *new = NULL;
+ struct stat dir_stat;
+ FcStrSet *dirs;
+
+ if (!cache)
+ return NULL;
+ if (FcStatChecksum (dir, &dir_stat) < 0)
+ goto bail;
+ dirs = FcStrSetCreate ();
+ if (!dirs)
+ goto bail;
+
+ /*
+ * Scan the dir
+ */
+ if (!FcDirScanConfig (NULL, dirs, NULL, dir, FcTrue, config))
+ goto bail1;
+ /*
+ * Rebuild the cache object
+ */
+ new = FcDirCacheRebuild (cache, &dir_stat, dirs);
+ if (!new)
+ goto bail1;
+ FcDirCacheUnload (cache);
+ /*
+ * Write out the cache file, ignoring any troubles
+ */
+ FcDirCacheWrite (new, config);
+
+bail1:
+ FcStrSetDestroy (dirs);
+bail:
+ return new;
+}
+
/*
* Read (or construct) the cache for a directory
*/