diff options
author | Thomas White <taw@physics.org> | 2021-04-19 15:34:43 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2021-04-19 15:34:43 +0200 |
commit | b126d28c8804fd30ca8934b3987e7a9cd1cfae93 (patch) | |
tree | 05547af18211da771e129f8f6f95114b9eb97af8 /libcrystfel/src/utils.c | |
parent | 1b81067618def8e2b675faaa297df0a55fcb4e17 (diff) |
Move file_exists to utils (and eliminate several duplicates)
Diffstat (limited to 'libcrystfel/src/utils.c')
-rw-r--r-- | libcrystfel/src/utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c index 053e952b..c7c956fa 100644 --- a/libcrystfel/src/utils.c +++ b/libcrystfel/src/utils.c @@ -818,6 +818,20 @@ char *load_entire_file(const char *filename) } +int file_exists(const char *filename) +{ + struct stat statbuf; + int r; + + r = stat(filename, &statbuf); + if ( r != 0 ) { + return 0; + } + + return 1; +} + + int compare_double(const void *av, const void *bv) { double a = *(double *)av; |