From e44e00afe02c980068cbca0ca3870b0b2a663397 Mon Sep 17 00:00:00 2001 From: Dimitar Zhekov Date: Fri, 18 Sep 2015 19:38:42 +0300 Subject: [PATCH] Fix configdir encoding configdir is initially in locale (glib) encoding. Converting it from UTF-8 is wrong, and it must be converted _to_ UTF-8 when used in geany_debug() - otherwise, Help -> Debug Messages fails assertion. POSIX only, under Windows the glib encoding is also UTF-8. Closes #658. --- src/libmain.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libmain.c b/src/libmain.c index 41286a85f..d58d1856f 100644 --- a/src/libmain.c +++ b/src/libmain.c @@ -568,7 +568,7 @@ static void parse_command_line_options(gint *argc, gchar ***argv) if (alternate_config) { - geany_debug("alternate config: %s", alternate_config); + geany_debug("Using alternate configuration directory"); app->configdir = alternate_config; } else @@ -668,7 +668,7 @@ static gint create_config_dir(void) g_free(old_dir); } #endif - geany_debug("creating config directory %s", app->configdir); + geany_debug("Creating configuration directory"); saved_errno = utils_mkdir(app->configdir, TRUE); } @@ -738,9 +738,6 @@ static gint setup_config_dir(void) { gint mkdir_result = 0; - /* convert configdir to locale encoding to avoid troubles */ - SETPTR(app->configdir, utils_get_locale_from_utf8(app->configdir)); - mkdir_result = create_config_dir(); if (mkdir_result != 0) { @@ -1013,6 +1010,7 @@ gint main_lib(gint argc, gchar **argv) GeanyDocument *doc; gint config_dir_result; const gchar *locale; + gchar *utf8_configdir; #if ! GLIB_CHECK_VERSION(2, 36, 0) g_type_init(); @@ -1101,7 +1099,9 @@ gint main_lib(gint argc, gchar **argv) gtk_major_version, gtk_minor_version, gtk_micro_version, glib_major_version, glib_minor_version, glib_micro_version); geany_debug("System data dir: %s", app->datadir); - geany_debug("User config dir: %s", app->configdir); + utf8_configdir = utils_get_utf8_from_locale(app->configdir); + geany_debug("User config dir: %s", utf8_configdir); + g_free(utf8_configdir); /* create the object so Geany signals can be connected in init() functions */ geany_object = geany_object_new(); -- 2.11.4.GIT