src/fccache.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) New commits: commit 3b4641ae7a7bf961221cd7b55cc0e25d9d1a6365 Merge: 91145a1 42b12fc Author: Akira TAGOH <akira@xxxxxxxxx> Date: Mon Apr 22 14:05:45 2024 +0000 Merge branch 'list-cache-dirs-on-fail' into 'main' More information when no writable cache directories Closes #413 See merge request fontconfig/fontconfig!323 commit 42b12fc7c0855cddecdf6f4a0a26b897d53432a5 Author: Akira TAGOH <akira@xxxxxxxxx> Date: Mon Apr 22 22:51:15 2024 +0900 More information when no writable cache directories Show cache directories fontconfig tries to test on loading to see where was no writable access. Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/413 diff --git a/src/fccache.c b/src/fccache.c index 54f76ac..e0dc4c9 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -1358,14 +1358,21 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) unsigned int magic; int written; const FcChar8 *sysroot = FcConfigGetSysRoot (config); + FcStrSet *cpath; /* * Write it to the first directory in the list which is writable */ + cpath = FcStrSetCreateEx (FCSS_GROW_BY_64); + if (!cpath) + return FcFalse; list = FcStrListCreate (config->cacheDirs); if (!list) + { + FcStrSetDestroy (cpath); return FcFalse; + } while ((test_dir = FcStrListNext (list))) { if (d) @@ -1404,12 +1411,26 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config) FcDirCacheCreateTagFile (d); break; } + /* Record a path that was supposed to be a cache directory */ + FcStrSetAdd (cpath, d); } } if (!test_dir) - fprintf (stderr, "Fontconfig error: No writable cache directories\n"); + { + FcStrList *l; + FcChar8 *s; + + l = FcStrListCreate (cpath); + fprintf (stderr, "\nFontconfig error: No writable cache directories\n"); + while ((s = FcStrListNext (l))) + { + fprintf (stderr, "\t%s\n", s); + } + FcStrListDone (l); + } if (d) FcStrFree (d); + FcStrSetDestroy (cpath); FcStrListDone (list); if (!cache_dir) return FcFalse;