mirror of
https://github.com/AppleWin/AppleWin.git
synced 2024-12-29 08:30:04 +00:00
Debugger: allow pathnames > CONSOLE_WIDTH(=80) for scripts run via CmdOutputrun()
. specifically for the DebuggerAutoRun.txt script (which runs at AppleWin start-up) . internally changed MAX_ARG_LEN from 127 to MAX_PATH(260), which is used to size Arg_t::sArg[]
This commit is contained in:
parent
9ee2daf72a
commit
ab9a856bc1
@ -6391,24 +6391,17 @@ Update_t CmdOutputRun (int nArgs)
|
|||||||
MemoryTextFile_t script;
|
MemoryTextFile_t script;
|
||||||
|
|
||||||
const std::string pFileName = g_aArgs[ 1 ].sArg;
|
const std::string pFileName = g_aArgs[ 1 ].sArg;
|
||||||
|
|
||||||
std::string sFileName;
|
std::string sFileName;
|
||||||
std::string sMiniFileName; // [CONSOLE_WIDTH];
|
|
||||||
|
|
||||||
// if (g_aArgs[1].bType & TYPE_QUOTED_2)
|
|
||||||
|
|
||||||
sMiniFileName = pFileName.substr(0, MIN(pFileName.size(), CONSOLE_WIDTH));
|
|
||||||
// strcat( sMiniFileName, ".aws" ); // HACK: MAGIC STRING
|
|
||||||
|
|
||||||
if (pFileName[0] == PATH_SEPARATOR || pFileName[1] == ':') // NB. Any prefix quote has already been stripped
|
if (pFileName[0] == PATH_SEPARATOR || pFileName[1] == ':') // NB. Any prefix quote has already been stripped
|
||||||
{
|
{
|
||||||
// Abs pathname
|
// Abs pathname
|
||||||
sFileName = sMiniFileName;
|
sFileName = pFileName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Rel pathname
|
// Rel pathname
|
||||||
sFileName = g_sCurrentDir + sMiniFileName;
|
sFileName = g_sCurrentDir + pFileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (script.Read( sFileName ))
|
if (script.Read( sFileName ))
|
||||||
@ -6428,8 +6421,9 @@ Update_t CmdOutputRun (int nArgs)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
std::string sMiniFileName = sFileName.substr(0, MIN(sFileName.size(), CONSOLE_WIDTH));
|
||||||
ConsolePrintFormat("%sCouldn't load filename:", CHC_ERROR);
|
ConsolePrintFormat("%sCouldn't load filename:", CHC_ERROR);
|
||||||
ConsolePrintFormat("%s%s", CHC_STRING, sFileName.c_str());
|
ConsolePrintFormat("%s%s", CHC_STRING, sMiniFileName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ConsoleUpdate();
|
return ConsoleUpdate();
|
||||||
@ -9017,16 +9011,32 @@ void DebugInitialize ()
|
|||||||
// Look in g_sCurrentDir, otherwise try g_sProgramDir
|
// Look in g_sCurrentDir, otherwise try g_sProgramDir
|
||||||
|
|
||||||
std::string pathname = g_sCurrentDir + debuggerAutoRunName;
|
std::string pathname = g_sCurrentDir + debuggerAutoRunName;
|
||||||
strncpy_s(g_aArgs[1].sArg, MAX_ARG_LEN, pathname.c_str(), _TRUNCATE);
|
if (pathname.size() >= MAX_PATH)
|
||||||
|
{
|
||||||
|
ConsolePrintFormat("%sPathname too long:", CHC_ERROR);
|
||||||
|
ConsolePrintFormat("%s%s", CHC_STRING, pathname.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy_s(g_aArgs[1].sArg, MAX_PATH, pathname.c_str(), _TRUNCATE);
|
||||||
CmdOutputRun(1);
|
CmdOutputRun(1);
|
||||||
|
}
|
||||||
|
|
||||||
if (!g_bScriptReadOk)
|
if (!g_bScriptReadOk)
|
||||||
{
|
{
|
||||||
pathname = g_sProgramDir + debuggerAutoRunName;
|
pathname = g_sProgramDir + debuggerAutoRunName;
|
||||||
strncpy_s(g_aArgs[1].sArg, MAX_ARG_LEN, pathname.c_str(), _TRUNCATE);
|
if (pathname.size() >= MAX_PATH)
|
||||||
|
{
|
||||||
|
ConsolePrintFormat("%sPathname too long:", CHC_ERROR);
|
||||||
|
ConsolePrintFormat("%s%s", CHC_STRING, pathname.c_str());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy_s(g_aArgs[1].sArg, MAX_PATH, pathname.c_str(), _TRUNCATE);
|
||||||
CmdOutputRun(1);
|
CmdOutputRun(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CmdMOTD(0);
|
CmdMOTD(0);
|
||||||
}
|
}
|
||||||
|
@ -266,9 +266,9 @@
|
|||||||
{
|
{
|
||||||
MAX_COMMAND_LEN = 12,
|
MAX_COMMAND_LEN = 12,
|
||||||
|
|
||||||
MAX_ARGS = 32, // was 40
|
MAX_ARGS = 32,
|
||||||
ARG_SYNTAX_ERROR= -1,
|
ARG_SYNTAX_ERROR= -1,
|
||||||
MAX_ARG_LEN = 127, // extended to allow font names, GH#481, any value is good > CONSOLE_WIDTH=80
|
MAX_ARG_LEN = MAX_PATH, // extended to allow font names, GH#481, any value is good > CONSOLE_WIDTH(=80)
|
||||||
};
|
};
|
||||||
|
|
||||||
// NOTE: All Commands return flags of what needs to be redrawn
|
// NOTE: All Commands return flags of what needs to be redrawn
|
||||||
@ -1023,7 +1023,7 @@ const DisasmData_t* pDisasmData; // If != NULL then bytes are marked up as data
|
|||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MAX_FONT_NAME = MAX_ARG_LEN // was 64
|
MAX_FONT_NAME = MAX_ARG_LEN
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FontSpacing_e
|
enum FontSpacing_e
|
||||||
|
Loading…
Reference in New Issue
Block a user