[geany/geany] 0ebf6a: Windows: convert the spawned command to locale encoding
Colomban Wendling
git-noreply at xxxxx
Wed Feb 19 14:54:51 UTC 2014
Branch: refs/heads/master
Author: Colomban Wendling <ban at herbesfolles.org>
Committer: Colomban Wendling <ban at herbesfolles.org>
Date: Wed, 19 Feb 2014 14:54:51 UTC
Commit: 0ebf6ab82e8a9232caaabf0dd845390307fa1c80
https://github.com/geany/geany/commit/0ebf6ab82e8a9232caaabf0dd845390307fa1c80
Log Message:
-----------
Windows: convert the spawned command to locale encoding
Converting to locale encoding is required to allows non-ASCII
characters in the command, e.g. in the file names.
Modified Paths:
--------------
src/win32.c
Modified: src/win32.c
7 files changed, 6 insertions(+), 1 deletions(-)
===================================================================
@@ -1038,6 +1038,7 @@ gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags fl
gchar *tmp_file = create_temp_file();
gchar *tmp_errfile = create_temp_file();
gchar *command;
+ gchar *locale_command;
if (env != NULL)
{
@@ -1052,9 +1053,12 @@ gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags fl
command = g_strjoinv(" ", argv);
SETPTR(command, g_strdup_printf("cmd.exe /S /C \"%s >%s 2>%s\"",
command, tmp_file, tmp_errfile));
+ locale_command = g_locale_from_utf8(command, -1, NULL, NULL, NULL);
+ if (! locale_command)
+ locale_command = g_strdup(command);
geany_debug("WIN32: actually running command:\n%s", command);
g_chdir(dir);
- ret = system(command);
+ ret = system(locale_command);
/* the command can return -1 as an exit code, so check errno also */
fail = ret == -1 && errno;
if (!fail)
@@ -1068,6 +1072,7 @@ gboolean win32_spawn(const gchar *dir, gchar **argv, gchar **env, GSpawnFlags fl
g_set_error_literal(error, G_SPAWN_ERROR, errno, g_strerror(errno));
g_free(command);
+ g_free(locale_command);
g_unlink(tmp_file);
g_free(tmp_file);
g_unlink(tmp_errfile);
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list