From 18451806b74f40465a69923640b9526cb32bfda6 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Thu, 23 Jan 2014 05:15:54 -0800 Subject: [PATCH] SCP: Added default simulator specific initialization file to be in the current working directory if one isn't found where the simulator binary is located (suggested by Jordi Guillaumes Pons in #101). --- scp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scp.c b/scp.c index d3fed078..e6857b04 100644 --- a/scp.c +++ b/scp.c @@ -921,7 +921,16 @@ else if (*argv[0]) { /* sim name arg? */ if ((np = match_ext (nbuf, "EXE"))) /* remove .exe */ *np = 0; strcat (nbuf, ".ini\""); /* add .ini" */ - stat = do_cmd (-1, nbuf); /* proc cmd file */ + stat = do_cmd (-1, nbuf) & ~SCPE_NOMESSAGE; /* proc default cmd file */ + if (stat == SCPE_OPENERR) { /* didn't exist/can't open? */ + np = strrchr (nbuf, '/'); /* stript path and try again in cwd */ + if (np == NULL) + np = strrchr (nbuf, '\\'); + if (np != NULL) { + *np = '"'; + stat = do_cmd (-1, np) & ~SCPE_NOMESSAGE; /* proc default cmd file */ + } + } } stat = SCPE_BARE_STATUS(stat); /* remove possible flag */