aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2022-07-06 13:41:08 +0200
committerThomas White <taw@physics.org>2022-07-06 13:41:08 +0200
commit5b087416a02a53c61d0827ee4bad50370320a0fb (patch)
treea52bea18f36b2d2ff6056c57952d289ada56f089 /src
parentd8e55abe45fa3efe1a886a34c46523f3c1f3ef23 (diff)
GUI: Invoke programs without path
Including the path wasn't working very well. One of the problems is that it prevents the use of a wrapper script for the programs, which is needed for certain environments. This commit just removes the path prefixes altogether.
Diffstat (limited to 'src')
-rw-r--r--src/crystfel_gui.c25
-rw-r--r--src/crystfel_gui.h2
-rw-r--r--src/gui_ambi.c5
-rw-r--r--src/gui_index.c11
-rw-r--r--src/gui_merge.c24
5 files changed, 8 insertions, 59 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 252e63ab..066422a3 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -1372,31 +1372,6 @@ char *get_crystfel_path_str()
}
-char *get_crystfel_exe(const char *program)
-{
- GFile *crystfel_path;
- char *exe_path;
- GFile *exe;
-
- crystfel_path = get_crystfel_path_gfile();
- if ( crystfel_path == NULL ) return NULL;
-
- exe = g_file_get_child(crystfel_path, program);
- if ( exe == NULL ) {
- ERROR("Couldn't determine executable path. "
- "This is OK provided the executable "
- "path is set correctly.\n");
- exe_path = strdup(program);
- } else {
- exe_path = g_file_get_path(exe);
- g_object_unref(exe);
- }
- g_object_unref(crystfel_path);
-
- return exe_path;
-}
-
-
struct gui_job_notes_page *add_job_notes_page(GtkWidget *notebook)
{
GtkWidget *box;
diff --git a/src/crystfel_gui.h b/src/crystfel_gui.h
index 3b2cdacd..aa40e70d 100644
--- a/src/crystfel_gui.h
+++ b/src/crystfel_gui.h
@@ -61,8 +61,6 @@ extern const char *selected_result(struct crystfelproject *proj);
extern char *get_crystfel_path_str(void);
-extern char *get_crystfel_exe(const char *program);
-
extern struct gui_job_notes_page *add_job_notes_page(GtkWidget *notebook);
extern GFile *make_job_folder(const char *job_title, const char *job_notes);
diff --git a/src/gui_ambi.c b/src/gui_ambi.c
index b160c6ec..d07efcf5 100644
--- a/src/gui_ambi.c
+++ b/src/gui_ambi.c
@@ -486,7 +486,6 @@ int write_ambigator_script(const char *filename,
const char *harvest_filename)
{
FILE *fh;
- char *exe_path;
int i;
fh = fopen(filename, "w");
@@ -500,9 +499,7 @@ int write_ambigator_script(const char *filename,
}
fprintf(fh, " > %s\n", intermediate_rel_filename);
- exe_path = get_crystfel_exe("ambigator");
- if ( exe_path == NULL ) return 1;
- fprintf(fh, "%s %s \\\n", exe_path, intermediate_rel_filename);
+ fprintf(fh, "ambigator %s \\\n", intermediate_rel_filename);
fprintf(fh, " -j %s", n_thread_str);
fprintf(fh, " -o \"%s\"", out_stream);
diff --git a/src/gui_index.c b/src/gui_index.c
index 99d8feb3..2634f525 100644
--- a/src/gui_index.c
+++ b/src/gui_index.c
@@ -81,7 +81,7 @@ void cell_explorer_sig(GtkWidget *widget, struct crystfelproject *proj)
streams = malloc((res->n_streams+2)*sizeof(gchar *));
if ( streams == NULL ) return;
- streams[0] = get_crystfel_exe("cell_explorer");
+ streams[0] = "cell_explorer";
for ( i=0; i<res->n_streams; i++ ) {
streams[i+1] = res->streams[i];
}
@@ -845,21 +845,14 @@ static char **indexamajig_command_line(const char *geom_filename,
{
char **args;
char tols[2048];
- char *indexamajig_path;
int i;
int n_args = 0;
args = malloc(64*sizeof(char *));
if ( args == NULL ) return NULL;
- indexamajig_path = get_crystfel_exe("indexamajig");
- if ( indexamajig_path == NULL ) {
- free(args);
- return NULL;
- }
-
/* The basics */
- add_arg(args, n_args++, indexamajig_path);
+ add_arg(args, n_args++, "indexamajig");
add_arg(args, n_args++, "-i");
add_arg(args, n_args++, files_list);
if ( geom_filename != NULL ) {
diff --git a/src/gui_merge.c b/src/gui_merge.c
index aa1fffcc..391957d7 100644
--- a/src/gui_merge.c
+++ b/src/gui_merge.c
@@ -358,7 +358,6 @@ static int write_partialator_script(const char *filename,
const char *log_folder)
{
FILE *fh;
- char *exe_path;
int i;
fh = fopen(filename, "w");
@@ -366,12 +365,7 @@ static int write_partialator_script(const char *filename,
fprintf(fh, "#!/bin/sh\n");
- exe_path = get_crystfel_exe("partialator");
- if ( exe_path == NULL ) {
- fclose(fh);
- return 1;
- }
- fprintf(fh, "%s \\\n", exe_path);
+ fprintf(fh, "partialator \\\n");
for ( i=0; i<input->n_streams; i++ ) {
fprintf(fh, "\"%s\" \\\n", input->streams[i]);
@@ -429,7 +423,6 @@ static int write_partialator_script(const char *filename,
static void add_process_hkl(FILE *fh,
- const char *exe_path,
struct gui_indexing_result *input,
struct merging_params *params,
const char *out_hkl,
@@ -440,7 +433,7 @@ static void add_process_hkl(FILE *fh,
{
int i;
- fprintf(fh, "%s \\\n", exe_path);
+ fprintf(fh, "process_hkl \\\n");
for ( i=0; i<input->n_streams; i++ ) {
fprintf(fh, " \"%s\" \\\n", input->streams[i]);
@@ -471,24 +464,17 @@ static int write_process_hkl_script(const char *filename,
const char *stderr_filename)
{
FILE *fh;
- char *exe_path;
fh = fopen(filename, "w");
if ( fh == NULL ) return 1;
fprintf(fh, "#!/bin/sh\n");
- exe_path = get_crystfel_exe("process_hkl");
- if ( exe_path == NULL ) {
- fclose(fh);
- return 1;
- }
-
- add_process_hkl(fh, exe_path, input, params, out_hkl,
+ add_process_hkl(fh, input, params, out_hkl,
stdout_filename, stderr_filename, "", "");
- add_process_hkl(fh, exe_path, input, params, out_hkl,
+ add_process_hkl(fh, input, params, out_hkl,
stdout_filename, stderr_filename, "--even-only", "1");
- add_process_hkl(fh, exe_path, input, params, out_hkl,
+ add_process_hkl(fh, input, params, out_hkl,
stdout_filename, stderr_filename, "--odd-only", "2");
fclose(fh);