mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-12 19:31:41 +00:00
Eliminate unnecessary uses of ConsoleFunction
This commit is contained in:
parent
6be736ff85
commit
2bbc716db6
12 changed files with 103 additions and 158 deletions
|
|
@ -2646,26 +2646,23 @@ DefineEngineFunction( getPrefsPath, const char *, ( const char* relativeFileName
|
|||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction( execPrefs, bool, 2, 4, "( string relativeFileName, bool noCalls=false, bool journalScript=false )"
|
||||
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
|
||||
"@param relativeFileName Name and path to file from project folder\n"
|
||||
"@param noCalls Deprecated\n"
|
||||
"@param journalScript Deprecated\n"
|
||||
"@return True if script was successfully executed\n"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@ingroup Scripting")
|
||||
DefineEngineFunction(execPrefs, bool, (const char* relativeFileName, bool noCalls, bool journalScript),(false, false),
|
||||
"@brief Manually execute a special script file that contains game or editor preferences\n\n"
|
||||
"@param relativeFileName Name and path to file from project folder\n"
|
||||
"@param noCalls Deprecated\n"
|
||||
"@param journalScript Deprecated\n"
|
||||
"@return True if script was successfully executed\n"
|
||||
"@note Appears to be useless in Torque 3D, should be deprecated\n"
|
||||
"@ingroup Scripting")
|
||||
{
|
||||
const char *filename = Platform::getPrefsPath(argv[1]);
|
||||
if(filename == NULL || *filename == 0)
|
||||
if (relativeFileName == NULL || *relativeFileName == 0)
|
||||
return false;
|
||||
|
||||
// Scripts do this a lot, so we may as well help them out
|
||||
if(! Platform::isFile(filename) && ! Torque::FS::IsFile(filename))
|
||||
if (!Platform::isFile(relativeFileName) && !Torque::FS::IsFile(relativeFileName))
|
||||
return true;
|
||||
|
||||
argv[0] = "exec";
|
||||
argv[1] = filename;
|
||||
return dAtob(Con::execute(argc, argv));
|
||||
return Con::executeFile(relativeFileName, noCalls, journalScript);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "core/tSimpleHashTable.h"
|
||||
#include "core/strings/stringFunctions.h"
|
||||
#include "core/stringTable.h"
|
||||
#include "console/console.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "console/compiler.h"
|
||||
|
||||
|
||||
|
|
@ -342,28 +342,26 @@ bool collapseScriptFilename(char *filename, U32 size, const char *src)
|
|||
// Console Functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
ConsoleFunction(expandFilename, const char*, 2, 2, "(string filename)"
|
||||
"@brief Grabs the full path of a specified file\n\n"
|
||||
"@param filename Name of the local file to locate\n"
|
||||
"@return String containing the full filepath on disk\n"
|
||||
"@ingroup FileSystem")
|
||||
DefineEngineFunction(expandFilename, const char*, (const char* filename),,
|
||||
"@brief Grabs the full path of a specified file\n\n"
|
||||
"@param filename Name of the local file to locate\n"
|
||||
"@return String containing the full filepath on disk\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
static const U32 bufSize = 1024;
|
||||
char* ret = Con::getReturnBuffer( bufSize );
|
||||
Con::expandScriptFilename(ret, bufSize, argv[1]);
|
||||
char* ret = Con::getReturnBuffer(bufSize);
|
||||
Con::expandScriptFilename(ret, bufSize, filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ConsoleFunction(expandOldFilename, const char*, 2, 2, "(string filename)"
|
||||
"@brief Retrofits a filepath that uses old Torque style\n\n"
|
||||
"@return String containing filepath with new formatting\n"
|
||||
"@ingroup FileSystem")
|
||||
DefineEngineFunction(expandOldFilename, const char*, (const char* filename),,
|
||||
"@brief Retrofits a filepath that uses old Torque style\n\n"
|
||||
"@return String containing filepath with new formatting\n"
|
||||
"@ingroup FileSystem")
|
||||
{
|
||||
TORQUE_UNUSED(argc);
|
||||
static const U32 bufSize = 1024;
|
||||
char* ret = Con::getReturnBuffer( bufSize );
|
||||
Con::expandOldScriptFilename(ret, bufSize, argv[1]);
|
||||
char* ret = Con::getReturnBuffer(bufSize);
|
||||
Con::expandOldScriptFilename(ret, bufSize, filename);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue