Deprecated sm_corecfgfile for sm_basepath (bug 2693, r=ds).

This commit is contained in:
David Anderson 2009-02-17 14:03:20 -05:00
parent 15d64b8486
commit 16033c1307
3 changed files with 25 additions and 20 deletions

View File

@ -4,14 +4,6 @@
*/
"Core"
{
/**
* Relative path to SourceMod's base directory. This is relative to the game/mod directory.
* Only change this if you have installed SourceMod in a non-default location.
*
* The default value is "addons/sourcemod"
*/
"BasePath" "addons/sourcemod"
/**
* This option determines if SourceMod logging is enabled.
*

View File

@ -76,9 +76,7 @@ void Hook_ExecDispatchPre()
const char *arg = cmd.Arg(1);
if (!g_bServerExecd
&& arg != NULL
&& strcmp(arg, g_ServerCfgFile->GetString()) == 0)
if (!g_bServerExecd && arg != NULL && strcmp(arg, g_ServerCfgFile->GetString()) == 0)
{
g_bGotTrigger = true;
}
@ -100,8 +98,7 @@ void Hook_ExecDispatchPost()
void CheckAndFinalizeConfigs()
{
if ((g_bServerExecd || g_ServerCfgFile == NULL)
&& g_bGotServerStart)
if ((g_bServerExecd || g_ServerCfgFile == NULL) && g_bGotServerStart)
{
#if SOURCE_ENGINE >= SE_ORANGEBOX
g_PendingInternalPush = true;

View File

@ -70,6 +70,12 @@ typedef ISourcePawnEngine *(*GET_SP_V1)();
typedef ISourcePawnEngine2 *(*GET_SP_V2)();
typedef void (*NOTIFYSHUTDOWN)();
#ifdef PLATFORM_WINDOWS
ConVar sm_basepath("sm_basepath", "addons\\sourcemod", 0, "SourceMod base path (set via command line)");
#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
ConVar sm_basepath("sm_basepath", "addons/sourcemod", 0, "SourceMod base path (set via command line)");
#endif
void ShutdownJIT()
{
NOTIFYSHUTDOWN notify = (NOTIFYSHUTDOWN)g_pJIT->GetSymbolAddress("NotifyShutdown");
@ -145,16 +151,26 @@ bool SourceModBase::InitializeSourceMod(char *error, size_t maxlength, bool late
}
}
/* Initialize CoreConfig so we can get SourceMod base path properly - this basically parses core.cfg */
g_CoreConfig.Initialize();
/* This shouldn't happen, but can't hurt to be safe */
if (!g_LibSys.PathExists(m_SMBaseDir) || !m_GotBasePath)
const char *basepath = icvar->GetCommandLineValue("sm_basepath");
/* Set a custom base path if there is one. */
if (basepath != NULL && basepath[0] != '\0')
{
g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/addons/sourcemod", g_BaseDir.c_str());
g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), "addons/sourcemod");
m_GotBasePath = true;
}
/* Otherwise, use a default and keep the m_GotBasePath unlocked. */
else
{
basepath = sm_basepath.GetDefault();
}
g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/%s", g_BaseDir.c_str(), basepath);
g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), "%s", basepath);
/* Initialize CoreConfig to get the SourceMod base path properly - this parses core.cfg */
g_CoreConfig.Initialize();
/* There will always be a path by this point, since it was force-set above. */
m_GotBasePath = true;
/* Attempt to load the JIT! */
char file[PLATFORM_MAX_PATH];