summaryrefslogtreecommitdiff
path: root/src/condition.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/condition.c')
-rw-r--r--src/condition.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/condition.c b/src/condition.c
index 1dce276c00..61812c2570 100644
--- a/src/condition.c
+++ b/src/condition.c
@@ -134,6 +134,14 @@ bool condition_test(Condition *c) {
case CONDITION_PATH_EXISTS:
return (access(c->parameter, F_OK) >= 0) == !c->negate;
+ case CONDITION_PATH_IS_DIRECTORY: {
+ struct stat st;
+
+ if (lstat(c->parameter, &st) < 0)
+ return !c->negate;
+ return S_ISDIR(st.st_mode) == !c->negate;
+ }
+
case CONDITION_DIRECTORY_NOT_EMPTY: {
int k;