From 0e8e7a687b2f824d537ae8e72882f6fe2aad92b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Sun, 8 Feb 2009 19:51:49 +0000 Subject: [PATCH] Fix path quoting problems on Windows. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3566 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 2 ++ plugins/vcdiff.c | 21 ++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3eec0da0c..f96dd8a26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ * plugins/filebrowser.c: Make Menu key and Shift-F10 working on the filebrowser treeview. Return TRUE if appropriate in the event handlers. + * plugins/vcdiff.c: + Fix path quoting problems on Windows. 2009-02-08 Frank Lanitz diff --git a/plugins/vcdiff.c b/plugins/vcdiff.c index 887ebdcc7..c5892657a 100644 --- a/plugins/vcdiff.c +++ b/plugins/vcdiff.c @@ -196,6 +196,17 @@ static void* find_cmd_env(gint cmd_type, gboolean cmd, const gchar* filename) } +static gchar *quote_path(const gchar *path) +{ +#ifdef G_OS_WIN32 + /* On Windows we need to quote the path in order to handle spaces in paths correctly. */ + return g_strconcat("\"", path, "\"", NULL); +#else + return g_strdup(path); +#endif +} + + static void* get_cmd_env(gint cmd_type, gboolean cmd, const gchar* filename, int *size) { int i; @@ -231,18 +242,18 @@ static void* get_cmd_env(gint cmd_type, gboolean cmd, const gchar* filename, int { if (argv[i] == DIRNAME) { - ret[i] = g_strdup(dir); + ret[i] = quote_path(dir); } else if (argv[i] == FILENAME) { - ret[i] = g_strdup(filename); + ret[i] = quote_path(filename); } else if (argv[i] == BASE_FILENAME) { - ret[i] = g_strdup(base_filename); + ret[i] = quote_path(base_filename); } else - ret[i] = g_strdup(argv[i]); + ret[i] = quote_path(argv[i]); } *size = len; @@ -345,7 +356,7 @@ static gchar *make_diff(const gchar *filename, gint cmd) /* CVS dump stuff to stderr when diff nested dirs */ if (strcmp(argv[0], "cvs") != 0 && NZV(std_error)) { - dialogs_show_msgbox(1, + dialogs_show_msgbox(GTK_MESSAGE_WARNING, _("%s exited with an error: \n%s."), argv[0], g_strstrip(std_error)); } else if (NZV(std_output))