diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui_ambi.c | 4 | ||||
-rw-r--r-- | src/gui_index.c | 24 | ||||
-rw-r--r-- | src/gui_merge.c | 10 |
3 files changed, 30 insertions, 8 deletions
diff --git a/src/gui_ambi.c b/src/gui_ambi.c index 4403c999..79cc5299 100644 --- a/src/gui_ambi.c +++ b/src/gui_ambi.c @@ -495,7 +495,7 @@ int write_ambigator_script(const char *filename, fprintf(fh, "cat \\\n"); for ( i=0; i<input->n_streams; i++ ) { - fprintf(fh, "%s \\\n", input->streams[i]); + fprintf(fh, "\"%s\" \\\n", input->streams[i]); } fprintf(fh, " > ambigator-input.stream\n"); @@ -504,7 +504,7 @@ int write_ambigator_script(const char *filename, fprintf(fh, "%s ambigator-input.stream \\\n", exe_path); fprintf(fh, " -j %s", n_thread_str); - fprintf(fh, " -o %s", out_stream); + fprintf(fh, " -o \"%s\"", out_stream); fprintf(fh, " -y %s", params->sym); if ( params->use_operator ) { fprintf(fh, " --operator=%s", params->operator); diff --git a/src/gui_index.c b/src/gui_index.c index 6ce406e3..ba9302a3 100644 --- a/src/gui_index.c +++ b/src/gui_index.c @@ -641,9 +641,31 @@ gint index_one_sig(GtkWidget *widget, struct crystfelproject *proj) } +static int contains_spaces(const char *str) +{ + int i; + size_t len; + len = strlen(str); + for ( i=0; i<len; i++ ) { + if ( str[i] == ' ' ) return 1; + } + return 0; +} + + static void add_arg(char **args, int pos, const char *label) { - args[pos] = strdup(label); + if ( contains_spaces(label) ) { + size_t len = strlen(label)+3; + args[pos] = malloc(len); + args[pos][0] = '"'; + args[pos][1] = '\0'; + strcat(args[pos], label); + args[pos][len-2] = '"'; + args[pos][len-1] = '\0'; + } else { + args[pos] = strdup(label); + } } diff --git a/src/gui_merge.c b/src/gui_merge.c index 497d6636..367d303a 100644 --- a/src/gui_merge.c +++ b/src/gui_merge.c @@ -365,13 +365,13 @@ static int write_partialator_script(const char *filename, fprintf(fh, "%s \\\n", exe_path); for ( i=0; i<input->n_streams; i++ ) { - fprintf(fh, "%s \\\n", input->streams[i]); + fprintf(fh, "\"%s\" \\\n", input->streams[i]); } fprintf(fh, " --model=%s", params->model); fprintf(fh, " -j %s", n_thread_str); - fprintf(fh, " -o %s", out_hkl); + fprintf(fh, " -o \"%s\"", out_hkl); fprintf(fh, " -y %s", params->symmetry); fprintf(fh, " --polarisation=%s", params->polarisation); @@ -385,7 +385,7 @@ static int write_partialator_script(const char *filename, } if ( params->custom_split != NULL ) { - fprintf(fh, " --custom-split=%s", params->custom_split); + fprintf(fh, " --custom-split=\"%s\"", params->custom_split); } if ( !params->scale ) { @@ -427,10 +427,10 @@ static void add_process_hkl(FILE *fh, fprintf(fh, "%s \\\n", exe_path); for ( i=0; i<input->n_streams; i++ ) { - fprintf(fh, " %s \\\n", input->streams[i]); + fprintf(fh, " \"%s\" \\\n", input->streams[i]); } - fprintf(fh, " -o %s%s", out_hkl, out_suffix); + fprintf(fh, " -o \"%s%s\"", out_hkl, out_suffix); fprintf(fh, " -y %s", params->symmetry); if ( params->scale ) { |