@@ -221,10 +221,21 @@ static void button_clicked(GtkWidget *widget,
221221 gchar * dir = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (filechooser ));
222222 char * composed = g_build_filename (dir , filename , NULL );
223223
224- // composed can now contain '\': on Windows it's the path separator,
225- // on other platforms it can be part of a regular folder name.
226- // This would later clash with variable substitution, so we have to escape them
224+ #ifdef _WIN32
225+ // Windows does not support forward slashes in filename,
226+ // but they can also be used as path separators.
227+ // To keep it consistent with Unix, we can just replace backslashes
228+ // with forward slashes.
229+ // This also means that we do not have problems with variable substitution.
230+ // TODO: Of course it would be better if we supported "natural"
231+ // Windows style path names.
232+ gchar * escaped = dt_util_str_replace (composed , "\\" , "/" );
233+ #else
234+ // On Unix, the backslash _can_ be part of a regular folder name.
235+ // So it has to be escaped, because it would clash with variable
236+ // substitution.
227237 gchar * escaped = dt_util_str_replace (composed , "\\" , "\\\\" );
238+ #endif
228239
229240 gtk_entry_set_text (GTK_ENTRY (d -> entry ), escaped );
230241 // the signal handler will write this to conf
0 commit comments