diff options
author | Berke Viktor <bviktor@hexchat.org> | 2012-11-04 21:40:39 +0100 |
---|---|---|
committer | Berke Viktor <bviktor@hexchat.org> | 2012-11-04 21:40:39 +0100 |
commit | 5c9283fc688004d3b519c8410141475ab3928a28 (patch) | |
tree | 92770dbdc372bbb601c0b9ffeecec80846faff26 | |
parent | 7873bfe211d6873c86a7dd1099c2d2f803790631 (diff) |
Fix for using -d with non-english locale
-rw-r--r-- | src/common/hexchat.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/common/hexchat.c b/src/common/hexchat.c index ea564a54..d33bba9b 100644 --- a/src/common/hexchat.c +++ b/src/common/hexchat.c @@ -956,11 +956,37 @@ main (int argc, char *argv[]) #ifdef WIN32 char hexchat_lang[13]; /* LC_ALL= plus 5 chars of hex_gui_lang and trailing \0 */ + int i; HANDLE mutex; #endif srand (time (0)); /* CL: do this only once! */ + /* We must check for the config dir parameter, otherwise load_config() will behave incorrectly. + * load_config() must come before fe_args() because fe_args() calls gtk_init() which needs to + * know the language which is set in the config. The code below is copy-pasted from fe_args() + * for the most part. */ + if (argc >= 3) + { + for (i = 1; i < argc - 1; i++) + { + if (strcmp (argv[i], "-d") == 0) + { + if (xdir) + { + g_free (xdir); + } + + xdir = strdup (argv[i + 1]); + + if (xdir[strlen (xdir) - 1] == G_DIR_SEPARATOR) + { + xdir[strlen (xdir) - 1] = 0; + } + } + } + } + load_config (); #ifdef WIN32 |