diff options
Diffstat (limited to 'utils/utils.c')
-rw-r--r-- | utils/utils.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/utils/utils.c b/utils/utils.c index ca7d7f2fc..8fcbc7f44 100644 --- a/utils/utils.c +++ b/utils/utils.c @@ -11,6 +11,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <sys/stat.h> #include "libxml/encoding.h" #include "libxml/uri.h" #include "netsurf/utils/log.h" @@ -275,3 +276,18 @@ char *get_host_from_url (char *url) { return host; } + + +/** + * Check if a directory exists. + */ + +bool is_dir(const char *path) +{ + struct stat s; + + if (stat(path, &s)) + return false; + + return S_ISDIR(s.st_mode) ? true : false; +} |