aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcrystfel/src/utils.c')
-rw-r--r--libcrystfel/src/utils.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c
index 10e4c38e..44faa7ee 100644
--- a/libcrystfel/src/utils.c
+++ b/libcrystfel/src/utils.c
@@ -933,6 +933,20 @@ int file_exists(const char *filename)
}
+int is_dir(const char *filename)
+{
+ struct stat statbuf;
+ int r;
+
+ r = stat(filename, &statbuf);
+ if ( r != 0 ) {
+ return 0;
+ }
+
+ return S_ISDIR(statbuf.st_mode);
+}
+
+
int compare_double(const void *av, const void *bv)
{
double a = *(double *)av;