diff options
author | Thomas White <taw@physics.org> | 2020-07-01 16:54:32 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:53:44 +0200 |
commit | 9040220452a9cc02706159c21c78e43b374446cf (patch) | |
tree | 2bdee963864fc3ea3a43a679c6a932f621e763d4 /libcrystfel | |
parent | 2e6c22d51ce130180f9d6e13f894c86fe3027e2e (diff) |
is_hdf5_file: Only check extension
It seems that H5Fis_hdf5 doesn't close the file. So, we rapidly run out
of file descriptors. Also, opening each file just to enumerate
single-frame files seems like a waste of time.
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/image-hdf5.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libcrystfel/src/image-hdf5.c b/libcrystfel/src/image-hdf5.c index 26caa13a..f698fed7 100644 --- a/libcrystfel/src/image-hdf5.c +++ b/libcrystfel/src/image-hdf5.c @@ -1644,5 +1644,10 @@ char **image_hdf5_expand_frames(const DataTemplate *dtempl, int is_hdf5_file(const char *filename) { - return (H5Fis_hdf5(filename) > 0); + const char *ext = NULL; + + ext = filename_extension(filename, NULL); + if ( ext == NULL ) return 0; + + return (strcmp(ext, ".h5") == 0); } |