If we get an error parsing options, see if there was no command and what

looks like an invalid system name. In that case, provide suggestions
for the system name instead of reporting the options error.
This commit is contained in:
Aaron Giles 2011-03-29 16:43:54 +00:00
parent 340fda9b68
commit 1b5697945d

View File

@ -181,7 +181,14 @@ int cli_execute(cli_options &options, osd_interface &osd, int argc, char **argv)
// parse the command line, adding any system-specific options
astring option_errors;
if (!options.parse_command_line(argc, argv, option_errors))
{
// if we failed, check for no command and a system name first; in that case error on the name
if (strlen(options.command()) == 0 && options.system() == NULL && strlen(options.system_name()) > 0)
throw emu_fatalerror(MAMERR_NO_SUCH_GAME, "Unknown system '%s'", options.system_name());
// otherwise, error on the options
throw emu_fatalerror(MAMERR_INVALID_CONFIG, "%s", option_errors.trimspace().cstr());
}
if (option_errors)
printf("Error in command line:\n%s\n", option_errors.trimspace().cstr());