1.1 --- a/core/sourcemod.cpp Tue Apr 03 07:02:27 2007 +0000
1.2 +++ b/core/sourcemod.cpp Thu Apr 05 03:02:00 2007 +0000
1.3 @@ -20,6 +20,7 @@
1.4 #include <sh_string.h>
1.5 #include "PluginSys.h"
1.6 #include "ShareSys.h"
1.7 +#include "CoreConfig.h"
1.8 #include "Logger.h"
1.9 #include "ExtensionSys.h"
1.10 #include "AdminCache.h"
1.11 @@ -65,13 +66,43 @@
1.12 {
1.13 m_IsMapLoading = false;
1.14 m_ExecPluginReload = false;
1.15 + m_GotBasePath = false;
1.16 +}
1.17 +
1.18 +CoreConfigErr SourceModBase::OnSourceModConfigChanged(const char *option, const char *value)
1.19 +{
1.20 + if (strcasecmp(option, "BasePath") == 0)
1.21 + {
1.22 + if (!m_GotBasePath)
1.23 + {
1.24 + g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/%s", g_BaseDir.c_str(), value);
1.25 + g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), value);
1.26 +
1.27 + m_GotBasePath = true;
1.28 +
1.29 + return CoreConfig_Okay;
1.30 + } else {
1.31 + return CoreConfig_NoRuntime;
1.32 + }
1.33 + }
1.34 +
1.35 + return CoreConfig_InvalidOption;
1.36 }
1.37
1.38 bool SourceModBase::InitializeSourceMod(char *error, size_t err_max, bool late)
1.39 {
1.40 g_BaseDir.assign(g_SMAPI->GetBaseDir());
1.41 - g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/addons/sourcemod", g_BaseDir.c_str());
1.42 - g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), "addons/sourcemod");
1.43 +
1.44 + /* Initialize CoreConfig so we can get SourceMod base path properly - this basically parses core.cfg */
1.45 + g_CoreConfig.Initialize();
1.46 +
1.47 + /* This shouldn't happen, but can't hurt to be safe */
1.48 + if (!m_GotBasePath || !g_LibSys.PathExists(m_SMBaseDir))
1.49 + {
1.50 + g_LibSys.PathFormat(m_SMBaseDir, sizeof(m_SMBaseDir), "%s/addons/sourcemod", g_BaseDir.c_str());
1.51 + g_LibSys.PathFormat(m_SMRelDir, sizeof(m_SMRelDir), "addons/sourcemod");
1.52 + m_GotBasePath = true;
1.53 + }
1.54
1.55 /* Attempt to load the JIT! */
1.56 char file[PLATFORM_MAX_PATH];