This repository has been archived on 2024-01-04. You can view files and clone it, but cannot push or open issues or pull requests.
ncsa-mosaic/libutils/checkDir.c

19 lines
352 B
C

#include <dirent.h>
#include <errno.h>
#include <stdlib.h>
int checkDir(char* directory) {
DIR *dir = opendir(directory);
if (dir) {
closedir(dir);
free (directory);
return 1;
} else if (ENOENT == errno) {
free (directory);
return 0;
} else {
free (directory);
return 0;
}
}