diff options
Diffstat (limited to 'fontconfig/src/fccompat.c')
-rw-r--r-- | fontconfig/src/fccompat.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/fontconfig/src/fccompat.c b/fontconfig/src/fccompat.c index a2171607c..d4f88c83f 100644 --- a/fontconfig/src/fccompat.c +++ b/fontconfig/src/fccompat.c @@ -219,3 +219,30 @@ FcRandom(void) return result; } + +#ifdef _WIN32 +#include <direct.h> +#define mkdir(path,mode) _mkdir(path) +#endif + +FcBool +FcMakeDirectory (const FcChar8 *dir) +{ + FcChar8 *parent; + FcBool ret; + + if (strlen ((char *) dir) == 0) + return FcFalse; + + parent = FcStrDirname (dir); + if (!parent) + return FcFalse; + if (access ((char *) parent, F_OK) == 0) + ret = mkdir ((char *) dir, 0755) == 0 && chmod ((char *) dir, 0755) == 0; + else if (access ((char *) parent, F_OK) == -1) + ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0755) == 0) && chmod ((char *) dir, 0755) == 0; + else + ret = FcFalse; + FcStrFree (parent); + return ret; +} |