From 6058555d8add3e55ddd0d181ea9c853ef8f8f391 Mon Sep 17 00:00:00 2001 From: Masamichi Hosoda Date: Wed, 11 Jan 2017 20:42:56 +0900 Subject: [PATCH] Fix cache file update on MinGW and Cygwin On Windows, opened or locked files cannot be removed. Since fontconfig locked an old cache file while updating the file, fontconfig failed to replace the file with updated file on Windows. This patch makes fontconfig does not lock the old cache file while updating it on Windows (both MinGW and Cygwin). --- src/fcdir.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fcdir.c b/src/fcdir.c index fd62a34..bd5b806 100644 --- a/src/fcdir.c +++ b/src/fcdir.c @@ -362,7 +362,9 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config) if (!dirs) goto bail1; +#if !defined (_WIN32) && !defined (__CYGWIN__) fd = FcDirCacheLock (dir, config); +#endif /* * Scan the dir */ @@ -382,7 +384,9 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config) FcDirCacheWrite (cache, config); bail2: +#if !defined (_WIN32) && !defined (__CYGWIN__) FcDirCacheUnlock (fd); +#endif FcStrSetDestroy (dirs); bail1: FcFontSetDestroy (set); @@ -417,7 +421,9 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config) if (!dirs) goto bail; +#if !defined (_WIN32) && !defined (__CYGWIN__) fd = FcDirCacheLock (dir, config); +#endif /* * Scan the dir */ @@ -436,7 +442,9 @@ FcDirCacheRescan (const FcChar8 *dir, FcConfig *config) FcDirCacheWrite (new, config); bail1: +#if !defined (_WIN32) && !defined (__CYGWIN__) FcDirCacheUnlock (fd); +#endif FcStrSetDestroy (dirs); bail: if (d) -- 2.8.3