Restructured a fair bit of cfgfiles.c. Besides making the code cleaner this allows

for better error handling (in fact the error message of check_prefs_dir () whould
make hexchat abort).
This commit is contained in:
Diogo Sousa
2013-05-13 01:58:08 +01:00
parent 61ed0829bd
commit d9d05e83ba
3 changed files with 107 additions and 59 deletions

View File

@@ -1013,9 +1013,10 @@ hexchat_execv (char * const argv[])
#endif
}
void
set_locale(void)
static void
set_locale (void)
{
#ifdef WIN32
const char const *langs[]={
"af", "sq", "am", "ast", "az", "eu", "be", "bg", "ca", "zh_CN", /* 0 .. 9 */
"zh_TW", "cs", "da", "nl", "en_GB", "en", "et", "fi", "fr", "gl", /* 10 .. 19 */
@@ -1034,6 +1035,7 @@ set_locale(void)
strcat (hexchat_lang, "en");
putenv (hexchat_lang);
#endif
}
int
@@ -1073,12 +1075,20 @@ main (int argc, char *argv[])
g_type_init ();
#endif
load_config ();
if (check_config_dir () == 0)
{
if (load_config () != 0)
load_default_config ();
} else
{
/* this is probably the first run */
load_default_config ();
make_config_dirs (); /* FIXME: if this fail display an error (?) */
make_dcc_dirs ();
}
#ifdef WIN32
/* we MUST do this after load_config () AND before fe_init (thus gtk_init) otherwise it will fail */
set_locale();
#endif
set_locale ();
#ifdef SOCKS
SOCKSinit (argv[0]);