example_packages/app_with_c/app/c_code.c
raw| 1 | #include <sys/stat.h> |
| 2 | /* |
| 3 | * Decides whether a given file name is a directory. |
| 4 | * return 1 if file exists and is a directory |
| 5 | * Source (Public domain): https://github.com/urbanjost/M_system |
| 6 | */ |
| 7 | int my_isdir(const char *path) |
| 8 | { |
| 9 | struct stat sb; |
| 10 | return stat(path, &sb) == 0 && S_ISDIR(sb.st_mode); |
| 11 | } |