From: Toni Wilen Date: Sun, 9 Jul 2023 17:24:06 +0000 (+0300) Subject: Validate config after command line parsing. X-Git-Tag: 5.1.0~162 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=080f6e45f9d6f49af387683297a40ba418f7e7b8;p=francis%2Fwinuae.git Validate config after command line parsing. --- diff --git a/main.cpp b/main.cpp index 613275ba..90e98092 100644 --- a/main.cpp +++ b/main.cpp @@ -1023,37 +1023,38 @@ static void parse_cmdline (int argc, TCHAR **argv) } #endif -static void parse_cmdline_and_init_file (int argc, TCHAR **argv) +static void parse_cmdline_and_init_file(int argc, TCHAR **argv) { _tcscpy (optionsfile, _T("")); #ifdef OPTIONS_IN_HOME { - TCHAR *home = getenv ("HOME"); - if (home != NULL && strlen (home) < 240) + TCHAR *home = getenv("HOME"); + if (home != NULL && strlen(home) < 240) { - _tcscpy (optionsfile, home); - _tcscat (optionsfile, _T("/")); + _tcscpy(optionsfile, home); + _tcscat(optionsfile, _T("/")); } } #endif - parse_cmdline_2 (argc, argv); + parse_cmdline_2(argc, argv); - _tcscat (optionsfile, restart_config); + _tcscat(optionsfile, restart_config); - if (! target_cfgfile_load (&currprefs, optionsfile, CONFIG_TYPE_DEFAULT, default_config)) { - write_log (_T("failed to load config '%s'\n"), optionsfile); + if (! target_cfgfile_load(&currprefs, optionsfile, CONFIG_TYPE_DEFAULT, default_config)) { + write_log(_T("failed to load config '%s'\n"), optionsfile); #ifdef OPTIONS_IN_HOME /* sam: if not found in $HOME then look in current directory */ - _tcscpy (optionsfile, restart_config); - target_cfgfile_load (&currprefs, optionsfile, CONFIG_TYPE_DEFAULT, default_config); + _tcscpy(optionsfile, restart_config); + target_cfgfile_load(&currprefs, optionsfile, CONFIG_TYPE_DEFAULT, default_config); #endif } - fixup_prefs (&currprefs, false); - parse_cmdline (argc, argv); + parse_cmdline(argc, argv); + + fixup_prefs(&currprefs, false); } /* Okay, this stuff looks strange, but it is here to encourage people who