From 5b087416a02a53c61d0827ee4bad50370320a0fb Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 6 Jul 2022 13:41:08 +0200 Subject: 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. --- src/crystfel_gui.c | 25 ------------------------- src/crystfel_gui.h | 2 -- src/gui_ambi.c | 5 +---- src/gui_index.c | 11 ++--------- src/gui_merge.c | 24 +++++------------------- 5 files changed, 8 insertions(+), 59 deletions(-) (limited to 'src') 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; in_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; in_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; in_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); -- cgit v1.2.3