aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/image.c14
-rw-r--r--libcrystfel/src/indexers/felix.c14
-rw-r--r--libcrystfel/src/utils.c14
-rw-r--r--libcrystfel/src/utils.h1
-rw-r--r--src/crystfel_gui.c12
5 files changed, 15 insertions, 40 deletions
diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c
index 1423c4d3..d5029a1c 100644
--- a/libcrystfel/src/image.c
+++ b/libcrystfel/src/image.c
@@ -629,20 +629,6 @@ int image_set_zero_mask(struct image *image,
}
-static int file_exists(const char *filename)
-{
- struct stat statbuf;
- int r;
-
- r = stat(filename, &statbuf);
- if ( r != 0 ) {
- return 0;
- }
-
- return 1;
-}
-
-
static int image_read_image_data(struct image *image,
const DataTemplate *dtempl,
const char *filename,
diff --git a/libcrystfel/src/indexers/felix.c b/libcrystfel/src/indexers/felix.c
index 89de5f70..a02f146f 100644
--- a/libcrystfel/src/indexers/felix.c
+++ b/libcrystfel/src/indexers/felix.c
@@ -730,20 +730,6 @@ void felix_cleanup(IndexingPrivate *pp)
}
-static int file_exists(const char *filename)
-{
- struct stat s;
-
- if ( stat(filename, &s) != 0 ) {
- if ( errno == ENOENT ) return 0;
- ERROR("Failed to check for %s.\n", filename);
- exit(1);
- }
-
- return 1;
-}
-
-
const char *felix_probe(UnitCell *cell)
{
pid_t pid;
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;
diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h
index 8bcb51ff..7f50ddc3 100644
--- a/libcrystfel/src/utils.h
+++ b/libcrystfel/src/utils.h
@@ -233,6 +233,7 @@ extern char *safe_basename(const char *in);
extern char *safe_strdup(const char *in);
extern void strip_extension(char *bfn);
extern char *load_entire_file(const char *filename);
+extern int file_exists(const char *filename);
extern const char *filename_extension(const char *fn, const char **ext2);
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 07626dbb..1ee4cff7 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -187,18 +187,6 @@ static int have_running_jobs(struct crystfelproject *proj)
}
-static int file_exists(const char *filename)
-{
- struct stat sb;
-
- if ( stat(filename, &sb) ) {
- return 0;
- } else {
- return 1;
- }
-}
-
-
/* Bring the image view up to date after changing the selected image */
void update_imageview(struct crystfelproject *proj)
{