added new path format functions
authorDavid Anderson <dvander@alliedmods.net>
Fri Jan 19 02:14:50 2007 +0000 (2007-01-19)
changeset 317e5342c8a0cf4
parent 316 1b691b2ff277
child 318 9575adefd45c
added new path format functions
exposed helpers as ISourceMod
core/CLogger.cpp
core/CTranslator.cpp
core/interfaces/ILibrarySys.h
core/interfaces/ISourceMod.h
core/msvc8/sourcemod_mm.vcproj
core/smn_filesystem.cpp
core/sourcemod.cpp
core/sourcemod.h
core/systems/ExtensionSys.cpp
core/systems/LibrarySys.cpp
core/systems/LibrarySys.h
core/systems/PluginSys.cpp
     1.1 --- a/core/CLogger.cpp	Fri Jan 19 01:50:42 2007 +0000
     1.2 +++ b/core/CLogger.cpp	Fri Jan 19 02:14:50 2007 +0000
     1.3 @@ -34,7 +34,7 @@
     1.4  
     1.5  	while (true)
     1.6  	{
     1.7 -		g_LibSys.PathFormat(_filename, sizeof(_filename), "%s/logs/L%02d%02d%03d.log", g_SourceMod.GetSMBaseDir(), curtime->tm_mon + 1, curtime->tm_mday, i);
     1.8 +		g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%02d%02d%03d.log", curtime->tm_mon + 1, curtime->tm_mday, i);
     1.9  		FILE *fp = fopen(_filename, "r");
    1.10  		if (!fp)
    1.11  		{
    1.12 @@ -104,7 +104,7 @@
    1.13  	m_CurDay = curtime->tm_mday;
    1.14  
    1.15  	char _filename[256];
    1.16 -	g_LibSys.PathFormat(_filename, sizeof(_filename), "%s/logs/errors_%02d%02d%02d.log", g_SourceMod.GetSMBaseDir(), curtime->tm_mon + 1, curtime->tm_mday, curtime->tm_year - 100);
    1.17 +	g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/errors_%02d%02d%02d.log", curtime->tm_mon + 1, curtime->tm_mday, curtime->tm_year - 100);
    1.18  	m_ErrFileName.assign(_filename);
    1.19  
    1.20  	switch (m_mode)
    1.21 @@ -119,7 +119,7 @@
    1.22  		}
    1.23  	case LoggingMode_Daily:
    1.24  		{
    1.25 -			g_LibSys.PathFormat(_filename, sizeof(_filename), "%s/logs/L%02d%02d.log", g_SourceMod.GetSMBaseDir(), curtime->tm_mon + 1, curtime->tm_mday);
    1.26 +			g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%02d%02d.log", curtime->tm_mon + 1, curtime->tm_mday);
    1.27  			m_NrmFileName.assign(_filename);
    1.28  			m_DailyPrintHdr = true;
    1.29  			break;
    1.30 @@ -183,7 +183,7 @@
    1.31  		if (m_CurDay != curtime->tm_mday)
    1.32  		{
    1.33  			char _filename[256];
    1.34 -			g_LibSys.PathFormat(_filename, sizeof(_filename), "%s/logs/L%02d%02d.log", g_SourceMod.GetSMBaseDir(), curtime->tm_mon + 1, curtime->tm_mday);
    1.35 +			g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/L%02d%02d.log", curtime->tm_mon + 1, curtime->tm_mday);
    1.36  			m_NrmFileName.assign(_filename);
    1.37  			m_CurDay = curtime->tm_mday;
    1.38  			m_DailyPrintHdr = true;
    1.39 @@ -228,7 +228,7 @@
    1.40  	if (curtime->tm_mday != m_CurDay)
    1.41  	{
    1.42  		char _filename[256];
    1.43 -		g_LibSys.PathFormat(_filename, sizeof(_filename), "%s/logs/errors_%02d%02d%02d.log", g_SourceMod.GetSMBaseDir(), curtime->tm_mon + 1, curtime->tm_mday, curtime->tm_year - 100);
    1.44 +		g_SourceMod.BuildPath(Path_SM, _filename, sizeof(_filename), "logs/errors_%02d%02d%02d.log", curtime->tm_mon + 1, curtime->tm_mday, curtime->tm_year - 100);
    1.45  		m_ErrFileName.assign(_filename);
    1.46  		m_CurDay = curtime->tm_mday;
    1.47  		m_ErrMapStart = false;
     2.1 --- a/core/CTranslator.cpp	Fri Jan 19 01:50:42 2007 +0000
     2.2 +++ b/core/CTranslator.cpp	Fri Jan 19 02:14:50 2007 +0000
     2.3 @@ -87,7 +87,7 @@
     2.4  
     2.5  	SMCParseError err;
     2.6  	char path[PLATFORM_MAX_PATH+1];
     2.7 -	g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s/translations/%s", g_SourceMod.GetSMBaseDir(), m_File.c_str());
     2.8 +	g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
     2.9  	unsigned int line=0, col=0;
    2.10  
    2.11  	if ((err=g_TextParser.ParseFile_SMC(path, this, &line, &col)) != SMCParse_Okay)
     3.1 --- a/core/interfaces/ILibrarySys.h	Fri Jan 19 01:50:42 2007 +0000
     3.2 +++ b/core/interfaces/ILibrarySys.h	Fri Jan 19 02:14:50 2007 +0000
     3.3 @@ -148,7 +148,7 @@
     3.4  		 * @param pathfmt	Format string of path.
     3.5  		 * @param ...		Format string arguments.
     3.6  		 */
     3.7 -		virtual void PathFormat(char *buffer, size_t maxlength, const char *pathfmt, ...) =0;
     3.8 +		virtual size_t PathFormat(char *buffer, size_t maxlength, const char *pathfmt, ...) =0;
     3.9  	};
    3.10  };
    3.11  
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/core/interfaces/ISourceMod.h	Fri Jan 19 02:14:50 2007 +0000
     4.3 @@ -0,0 +1,74 @@
     4.4 +#ifndef _INCLUDE_SOURCEMOD_MAIN_HELPER_INTERFACE_H_
     4.5 +#define _INCLUDE_SOURCEMOD_MAIN_HELPER_INTERFACE_H_
     4.6 +
     4.7 +#include <IShareSys.h>
     4.8 +
     4.9 +#define SMINTERFACE_SOURCEMOD_NAME		"ISourceMod"
    4.10 +#define SMINTERFACE_SOURCEMOD_VERSION	1
    4.11 +
    4.12 +namespace SourceMod
    4.13 +{
    4.14 +	enum PathType
    4.15 +	{
    4.16 +		Path_None = 0,
    4.17 +		Path_Game,
    4.18 +		Path_SM,
    4.19 +	};
    4.20 +
    4.21 +	class ISourceMod : public SMInterface
    4.22 +	{
    4.23 +	public:
    4.24 +		virtual const char *GetInterfaceName()
    4.25 +		{
    4.26 +			return SMINTERFACE_SOURCEMOD_NAME;
    4.27 +		}
    4.28 +		virtual unsigned int GetInterfaceVersion()
    4.29 +		{
    4.30 +			return SMINTERFACE_SOURCEMOD_VERSION;
    4.31 +		}
    4.32 +	public:
    4.33 +		/**
    4.34 +		 * @brief Returns the full path to the mod directory.
    4.35 +		 *
    4.36 +		 * @return			A string containing the full mod path.
    4.37 +		 */
    4.38 +		virtual const char *GetModPath() =0;
    4.39 +
    4.40 +		/**
    4.41 +		 * @brief Returns the full path to the SourceMod directory.
    4.42 +		 *
    4.43 +		 * @return			A string containing the full SourceMod path.
    4.44 +		 */
    4.45 +		virtual const char *GetSourceModPath() =0;
    4.46 +
    4.47 +		/**
    4.48 +		 * @brief Builds a platform path for a specific target base path.
    4.49 +		 *
    4.50 +		 * @param type		Type of path to use as a base.
    4.51 +		 * @param buffer	Buffer to write to.
    4.52 +		 * @param maxlength	Size of buffer.
    4.53 +		 * @param format	Format string.
    4.54 +		 * @param ...		Format arguments.
    4.55 +		 * @return			Number of bytes written.
    4.56 +		 */
    4.57 +		virtual size_t BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...) =0;
    4.58 +
    4.59 +		/**
    4.60 +		 * @brief Logs a message to the SourceMod logs.
    4.61 +		 *
    4.62 +		 * @param format	Message format.
    4.63 +		 * @param ...		Message format parameters.
    4.64 +		 */
    4.65 +		virtual void LogMessage(IExtension *pExt, const char *format, ...) =0;
    4.66 +
    4.67 +		/**
    4.68 +		 * @brief Logs a message to the SourceMod error logs.
    4.69 +		 *
    4.70 +		 * @param format	Message format.
    4.71 +		 * @param ...		Message format parameters.
    4.72 +		 */
    4.73 +		virtual void LogError(IExtension *pExt, const char *format, ...) =0;
    4.74 +	};
    4.75 +};
    4.76 +
    4.77 +#endif //_INCLUDE_SOURCEMOD_MAIN_HELPER_INTERFACE_H_
     5.1 --- a/core/msvc8/sourcemod_mm.vcproj	Fri Jan 19 01:50:42 2007 +0000
     5.2 +++ b/core/msvc8/sourcemod_mm.vcproj	Fri Jan 19 02:14:50 2007 +0000
     5.3 @@ -330,6 +330,10 @@
     5.4  				>
     5.5  			</File>
     5.6  			<File
     5.7 +				RelativePath="..\interfaces\ISourceMod.h"
     5.8 +				>
     5.9 +			</File>
    5.10 +			<File
    5.11  				RelativePath="..\interfaces\ITextParsers.h"
    5.12  				>
    5.13  			</File>
     6.1 --- a/core/smn_filesystem.cpp	Fri Jan 19 01:50:42 2007 +0000
     6.2 +++ b/core/smn_filesystem.cpp	Fri Jan 19 02:14:50 2007 +0000
     6.3 @@ -49,7 +49,7 @@
     6.4  	}
     6.5  
     6.6  	char realpath[PLATFORM_MAX_PATH+1];
     6.7 -	g_LibSys.PathFormat(realpath, sizeof(realpath), "%s/%s", g_SourceMod.GetBaseDir(), path);
     6.8 +	g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", path);
     6.9  
    6.10  	IDirectory *pDir = g_LibSys.OpenDirectory(realpath);
    6.11  	if (!pDir)
    6.12 @@ -127,7 +127,7 @@
    6.13  	}
    6.14  
    6.15  	char realpath[PLATFORM_MAX_PATH+1];
    6.16 -	g_LibSys.PathFormat(realpath, sizeof(realpath), "%s/%s", g_SourceMod.GetBaseDir(), name);
    6.17 +	g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
    6.18  
    6.19  	FILE *pFile = fopen(realpath, mode);
    6.20  	if (!pFile)
    6.21 @@ -149,7 +149,7 @@
    6.22  	}
    6.23  
    6.24  	char realpath[PLATFORM_MAX_PATH+1];
    6.25 -	g_LibSys.PathFormat(realpath, sizeof(realpath), "%s/%s", g_SourceMod.GetBaseDir(), name);
    6.26 +	g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
    6.27  
    6.28  	return (unlink(realpath)) ? 0 : 1;
    6.29  }
    6.30 @@ -253,7 +253,7 @@
    6.31  	}
    6.32  
    6.33  	char realpath[PLATFORM_MAX_PATH+1];
    6.34 -	g_LibSys.PathFormat(realpath, sizeof(realpath), "%s/%s", g_SourceMod.GetBaseDir(), name);
    6.35 +	g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
    6.36  #ifdef PLATFORM_WINDOWS
    6.37  	struct _stat s;
    6.38  	if (_stat(realpath, &s) != 0)
    6.39 @@ -295,9 +295,9 @@
    6.40  	}
    6.41  
    6.42  	char new_realpath[PLATFORM_MAX_PATH+1];
    6.43 -	g_LibSys.PathFormat(new_realpath, sizeof(new_realpath), "%s/%s", g_SourceMod.GetBaseDir(), newpath);
    6.44 +	g_SourceMod.BuildPath(Path_SM, new_realpath, sizeof(new_realpath), "%s", newpath);
    6.45  	char old_realpath[PLATFORM_MAX_PATH+1];
    6.46 -	g_LibSys.PathFormat(old_realpath, sizeof(old_realpath), "%s/%s", g_SourceMod.GetBaseDir(), oldpath);
    6.47 +	g_SourceMod.BuildPath(Path_SM, old_realpath, sizeof(old_realpath), "%s", oldpath);
    6.48  
    6.49  #ifdef PLATFORM_WINDOWS
    6.50  	return (MoveFileA(old_realpath, new_realpath)) ? 1 : 0;
    6.51 @@ -317,7 +317,7 @@
    6.52  	}
    6.53  
    6.54  	char realpath[PLATFORM_MAX_PATH+1];
    6.55 -	g_LibSys.PathFormat(realpath, sizeof(realpath), "%s/%s", g_SourceMod.GetBaseDir(), name);
    6.56 +	g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
    6.57  #ifdef PLATFORM_WINDOWS
    6.58  	struct _stat s;
    6.59  	if (_stat(realpath, &s) != 0)
    6.60 @@ -354,7 +354,7 @@
    6.61  	}
    6.62  
    6.63  	char realpath[PLATFORM_MAX_PATH+1];
    6.64 -	g_LibSys.PathFormat(realpath, sizeof(realpath), "%s/%s", g_SourceMod.GetBaseDir(), name);
    6.65 +	g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
    6.66  #ifdef PLATFORM_WINDOWS
    6.67  	struct _stat s;
    6.68  	if (_stat(realpath, &s) != 0)
    6.69 @@ -391,7 +391,7 @@
    6.70  	}
    6.71  
    6.72  	char realpath[PLATFORM_MAX_PATH+1];
    6.73 -	g_LibSys.PathFormat(realpath, sizeof(realpath), "%s/%s", g_SourceMod.GetBaseDir(), name);
    6.74 +	g_SourceMod.BuildPath(Path_SM, realpath, sizeof(realpath), "%s", name);
    6.75  
    6.76  	return (rmdir(realpath)) ? 0 : 1;
    6.77  }
     7.1 --- a/core/sourcemod.cpp	Fri Jan 19 01:50:42 2007 +0000
     7.2 +++ b/core/sourcemod.cpp	Fri Jan 19 02:14:50 2007 +0000
     7.3 @@ -50,7 +50,7 @@
     7.4  	char file[PLATFORM_MAX_PATH];
     7.5  	char myerror[255];
     7.6  	g_SMAPI->PathFormat(file, sizeof(file), "%s/bin/sourcepawn.jit.x86.%s",
     7.7 -		GetSMBaseDir(),
     7.8 +		GetSourceModPath(),
     7.9  		PLATFORM_LIB_EXT
    7.10  		);
    7.11  
    7.12 @@ -150,6 +150,9 @@
    7.13  		pBase->OnSourceModAllInitialized();
    7.14  		pBase = pBase->m_pGlobalClassNext;
    7.15  	}
    7.16 +
    7.17 +	/* Add us now... */
    7.18 +	g_ShareSys.AddInterface(NULL, this);
    7.19  }
    7.20  
    7.21  bool SourceModBase::LevelInit(char const *pMapName, char const *pMapEntities, char const *pOldLevel, char const *pLandmarkName, bool loadGame, bool background)
    7.22 @@ -175,14 +178,12 @@
    7.23  	char config_path[PLATFORM_MAX_PATH];
    7.24  	char plugins_path[PLATFORM_MAX_PATH];
    7.25  
    7.26 -	g_SMAPI->PathFormat(config_path, 
    7.27 +	BuildPath(Path_SM, config_path, 
    7.28  		sizeof(config_path),
    7.29 -		"%s/configs/plugin_settings.cfg",
    7.30 -		GetSMBaseDir());
    7.31 -	g_SMAPI->PathFormat(plugins_path,
    7.32 +		"configs/plugin_settings.cfg");
    7.33 +	BuildPath(Path_SM, plugins_path,
    7.34  		sizeof(plugins_path),
    7.35 -		"%s/plugins",
    7.36 -		GetSMBaseDir());
    7.37 +		"plugins");
    7.38  
    7.39  	/* Run the first pass */
    7.40  	g_PluginSys.LoadAll_FirstPass(config_path, plugins_path);
    7.41 @@ -197,6 +198,31 @@
    7.42  	g_Extensions.MarkAllLoaded();
    7.43  }
    7.44  
    7.45 +size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...)
    7.46 +{
    7.47 +	char _buffer[PLATFORM_MAX_PATH+1];
    7.48 +	va_list ap;
    7.49 +
    7.50 +	va_start(ap, format);
    7.51 +	vsnprintf(_buffer, PLATFORM_MAX_PATH, format, ap);
    7.52 +	va_end(ap);
    7.53 +
    7.54 +	const char *base = NULL;
    7.55 +	if (type == Path_Game)
    7.56 +	{
    7.57 +		base = GetModPath();
    7.58 +	} else if (type == Path_SM) {
    7.59 +		base = GetSourceModPath();
    7.60 +	}
    7.61 +
    7.62 +	if (base)
    7.63 +	{
    7.64 +		return g_LibSys.PathFormat(buffer, maxlength, "%s/%s", base, _buffer);
    7.65 +	} else {
    7.66 +		return g_LibSys.PathFormat(buffer, maxlength, "%s", _buffer);
    7.67 +	}
    7.68 +}
    7.69 +
    7.70  void SourceModBase::CloseSourceMod()
    7.71  {
    7.72  	/* Notify! */
    7.73 @@ -219,12 +245,50 @@
    7.74  	ShutdownJIT();
    7.75  }
    7.76  
    7.77 -const char *SourceModBase::GetSMBaseDir()
    7.78 +void SourceModBase::LogMessage(IExtension *pExt, const char *format, ...)
    7.79 +{
    7.80 +	IExtensionInterface *pAPI = pExt->GetAPI();
    7.81 +	const char *tag = pAPI->GetExtensionTag();
    7.82 +	char buffer[2048];
    7.83 +	va_list ap;
    7.84 +
    7.85 +	va_start(ap, format);
    7.86 +	vsnprintf(buffer, sizeof(buffer), format, ap);
    7.87 +	va_end(ap);
    7.88 +
    7.89 +	if (tag)
    7.90 +	{
    7.91 +		g_Logger.LogMessage("[%s] %s", tag, buffer);
    7.92 +	} else {
    7.93 +		g_Logger.LogMessage("%s", buffer);
    7.94 +	}
    7.95 +}
    7.96 +
    7.97 +void SourceModBase::LogError(IExtension *pExt, const char *format, ...)
    7.98 +{
    7.99 +	IExtensionInterface *pAPI = pExt->GetAPI();
   7.100 +	const char *tag = pAPI->GetExtensionTag();
   7.101 +	char buffer[2048];
   7.102 +	va_list ap;
   7.103 +
   7.104 +	va_start(ap, format);
   7.105 +	vsnprintf(buffer, sizeof(buffer), format, ap);
   7.106 +	va_end(ap);
   7.107 +
   7.108 +	if (tag)
   7.109 +	{
   7.110 +		g_Logger.LogError("[%s] %s", tag, buffer);
   7.111 +	} else {
   7.112 +		g_Logger.LogError("%s", buffer);
   7.113 +	}
   7.114 +}
   7.115 +
   7.116 +const char *SourceModBase::GetSourceModPath()
   7.117  {
   7.118  	return m_SMBaseDir;
   7.119  }
   7.120  
   7.121 -const char *SourceModBase::GetBaseDir()
   7.122 +const char *SourceModBase::GetModPath()
   7.123  {
   7.124  	return g_BaseDir.c_str();
   7.125  }
     8.1 --- a/core/sourcemod.h	Fri Jan 19 01:50:42 2007 +0000
     8.2 +++ b/core/sourcemod.h	Fri Jan 19 02:14:50 2007 +0000
     8.3 @@ -2,12 +2,13 @@
     8.4  #define _INCLUDE_SOURCEMOD_GLOBALHEADER_H_
     8.5  
     8.6  #include "sm_globals.h"
     8.7 +#include <ISourceMod.h>
     8.8  
     8.9  /**
    8.10   * @brief Implements SourceMod's global overall management, API, and logic
    8.11   */
    8.12  
    8.13 -class SourceModBase
    8.14 +class SourceModBase : public ISourceMod
    8.15  {
    8.16  public:
    8.17  	SourceModBase();
    8.18 @@ -37,15 +38,12 @@
    8.19  	 */
    8.20  	bool IsMapLoading();
    8.21  
    8.22 -	/**
    8.23 -	 * @brief Returns the base SourceMod folder.
    8.24 -	 */
    8.25 -	const char *GetSMBaseDir();
    8.26 -
    8.27 -	/**
    8.28 -	 * @brief Returns the base folder for file natives.
    8.29 -	 */
    8.30 -	const char *GetBaseDir();
    8.31 +public: //ISourceMod
    8.32 +	const char *GetModPath();
    8.33 +	const char *GetSourceModPath();
    8.34 +	size_t BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...);
    8.35 +	void LogMessage(IExtension *pExt, const char *format, ...);
    8.36 +	void LogError(IExtension *pExt, const char *format, ...);
    8.37  private:
    8.38  	/**
    8.39  	 * @brief Loading plugins
     9.1 --- a/core/systems/ExtensionSys.cpp	Fri Jan 19 01:50:42 2007 +0000
     9.2 +++ b/core/systems/ExtensionSys.cpp	Fri Jan 19 02:14:50 2007 +0000
     9.3 @@ -20,7 +20,7 @@
     9.4  	m_FullyLoaded = false;
     9.5  
     9.6  	char path[PLATFORM_MAX_PATH+1];
     9.7 -	g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s/extensions/%s", g_SourceMod.GetSMBaseDir(), filename);
     9.8 +	g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "extensions/%s", filename);
     9.9  
    9.10  	m_pLib = g_LibSys.OpenLibrary(path, error, err_max);
    9.11  
    10.1 --- a/core/systems/LibrarySys.cpp	Fri Jan 19 01:50:42 2007 +0000
    10.2 +++ b/core/systems/LibrarySys.cpp	Fri Jan 19 02:14:50 2007 +0000
    10.3 @@ -282,7 +282,7 @@
    10.4  	return new CLibrary(lib);
    10.5  }
    10.6  
    10.7 -void LibrarySystem::PathFormat(char *buffer, size_t len, const char *fmt, ...)
    10.8 +size_t LibrarySystem::PathFormat(char *buffer, size_t len, const char *fmt, ...)
    10.9  {
   10.10  	va_list ap;
   10.11  	va_start(ap,fmt);
   10.12 @@ -298,4 +298,6 @@
   10.13  			buffer[i] = PLATFORM_SEP_CHAR;
   10.14  		}
   10.15  	}
   10.16 +
   10.17 +	return mylen;
   10.18  }
    11.1 --- a/core/systems/LibrarySys.h	Fri Jan 19 01:50:42 2007 +0000
    11.2 +++ b/core/systems/LibrarySys.h	Fri Jan 19 02:14:50 2007 +0000
    11.3 @@ -59,7 +59,7 @@
    11.4  	virtual bool IsPathFile(const char *path);
    11.5  	virtual bool IsPathDirectory(const char *path);
    11.6  	virtual void GetPlatformError(char *error, size_t err_max);
    11.7 -	virtual void PathFormat(char *buffer, size_t len, const char *fmt, ...);
    11.8 +	virtual size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
    11.9  };
   11.10  
   11.11  extern LibrarySystem g_LibSys;
    12.1 --- a/core/systems/PluginSys.cpp	Fri Jan 19 01:50:42 2007 +0000
    12.2 +++ b/core/systems/PluginSys.cpp	Fri Jan 19 02:14:50 2007 +0000
    12.3 @@ -100,7 +100,7 @@
    12.4  CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength)
    12.5  {
    12.6  	char fullpath[PLATFORM_MAX_PATH+1];
    12.7 -	g_LibSys.PathFormat(fullpath, sizeof(fullpath), "%s/plugins/%s", g_SourceMod.GetSMBaseDir(), file);
    12.8 +	g_SourceMod.BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", file);
    12.9  	FILE *fp = fopen(fullpath, "rb");
   12.10  
   12.11  	CPlugin *pPlugin = new CPlugin(file);