[babl/wip/msvc: 12/20] babl/babl-cache.c: Define S_ISDIR and S_ISREG on Windows



commit 6489988a9114f6e0e9d07e9290596e79ed1b4e93
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Jan 20 17:07:38 2020 +0800

    babl/babl-cache.c: Define S_ISDIR and S_ISREG on Windows
    
    ...when we are building for Visual Studio, since these macros are
    not defined by Visual Studio's sys/stat.h

 babl/babl-cache.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/babl/babl-cache.c b/babl/babl-cache.c
index 7479c9068..8fe6b55f9 100644
--- a/babl/babl-cache.c
+++ b/babl/babl-cache.c
@@ -28,6 +28,14 @@
 
 #ifdef _WIN32
 #define FALLBACK_CACHE_PATH  "C:/babl-fishes.txt"
+
+#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
+#endif
+#if !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#endif
+
 #else
 #define FALLBACK_CACHE_PATH  "/tmp/babl-fishes.txt"
 #endif


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]