mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 13:21:10 +00:00
EXEC: Search for CFG by file path
This commit is contained in:
parent
077469cbab
commit
de0da37691
1 changed files with 15 additions and 3 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
#include "p_setup.h"
|
#include "p_setup.h"
|
||||||
#include "lua_script.h"
|
#include "lua_script.h"
|
||||||
|
#include "d_netfil.h" // findfile
|
||||||
|
|
||||||
//========
|
//========
|
||||||
// protos.
|
// protos.
|
||||||
|
@ -635,6 +636,7 @@ static void COM_CEchoDuration_f(void)
|
||||||
static void COM_Exec_f(void)
|
static void COM_Exec_f(void)
|
||||||
{
|
{
|
||||||
UINT8 *buf = NULL;
|
UINT8 *buf = NULL;
|
||||||
|
char filename[256];
|
||||||
|
|
||||||
if (COM_Argc() < 2 || COM_Argc() > 3)
|
if (COM_Argc() < 2 || COM_Argc() > 3)
|
||||||
{
|
{
|
||||||
|
@ -643,14 +645,24 @@ static void COM_Exec_f(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// load file
|
// load file
|
||||||
|
// Try with Argv passed verbatim first, for back compat
|
||||||
FIL_ReadFile(COM_Argv(1), &buf);
|
FIL_ReadFile(COM_Argv(1), &buf);
|
||||||
|
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
// Now try by searching the file path
|
||||||
|
// filename is modified with the full found path
|
||||||
|
strcpy(filename, COM_Argv(1));
|
||||||
|
if (findfile(filename, NULL, true) != FS_NOTFOUND)
|
||||||
|
FIL_ReadFile(filename, &buf);
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
if (!COM_CheckParm("-noerror"))
|
if (!COM_CheckParm("-noerror"))
|
||||||
CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1));
|
CONS_Printf(M_GetText("couldn't execute file %s\n"), COM_Argv(1));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!COM_CheckParm("-silent"))
|
if (!COM_CheckParm("-silent"))
|
||||||
CONS_Printf(M_GetText("executing %s\n"), COM_Argv(1));
|
CONS_Printf(M_GetText("executing %s\n"), COM_Argv(1));
|
||||||
|
|
Loading…
Reference in a new issue