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.
This commit is contained in:
Dimitar Zhekov 2015-09-18 19:38:42 +03:00 committed by Colomban Wendling
parent 4c6bd09b5a
commit e44e00afe0

View File

@ -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();