Index: src/compat_fs.c =================================================================== --- src/compat_fs.c (revision 8819) +++ src/compat_fs.c (revision 8820) @@ -300,3 +300,11 @@ return 0; } + +int pcb_is_dir(const char *path) +{ + struct stat st; + if (stat(path, &st) != 0) + return 0; + return S_ISDIR(st.st_mode); +} Index: src/compat_fs.h =================================================================== --- src/compat_fs.h (revision 8819) +++ src/compat_fs.h (revision 8820) @@ -12,3 +12,6 @@ * (this fact is a little confusing) */ int pcb_tempfile_unlink(char *name); + +/* Return non-zero if path is a directory */ +int pcb_is_dir(const char *path);