diff --git a/.gitignore b/.gitignore index fb12ca9..48900b0 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .grok/ .idea/ .vscode/ +.DS_Store build/ diff --git a/src/cnadd.c b/src/cnadd.c index 32a3d03..4413542 100644 --- a/src/cnadd.c +++ b/src/cnadd.c @@ -11,8 +11,8 @@ int ensure_directory_exists(const char *path) { struct stat st; if (stat(path, &st) == 0) { - /* Path exists, check if it's a directory */ - if (S_ISDIR(st.st_mode)) { + /* Path exists, check if it's a directory using bit test */ + if ((st.st_mode & S_IFMT) == S_IFDIR) { return 1; } else { fprintf(stderr, "Error: %s exists but is not a directory\n", path);