aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/utils.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2024-01-12 10:46:10 +0100
committerThomas White <taw@physics.org>2024-01-12 10:46:10 +0100
commita397af95ba722b10ae552158ea1b343b5899451a (patch)
tree64a862db26aca0cda7035ed6435fd0a35252d484 /libcrystfel/src/utils.c
parent2d72edc620c6746bed5c10d148b45bb49a58c73a (diff)
align_detector: Enumerate directory contents if necessary
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;