added a new function to ILibrarySys

added define in SDK for LIBRARYSYS

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401198
This commit is contained in:
David Anderson 2007-07-27 18:24:09 +00:00
parent fa07c9d8a2
commit 1154b20fc9
7 changed files with 25 additions and 4 deletions

View File

@ -200,7 +200,7 @@ bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
sizeof(build)-len,
"/%s",
cur_ptr);
if (!g_LibSys.CreateDirectory(build))
if (!g_LibSys.CreateFolder(build))
{
break;
}

View File

@ -349,7 +349,7 @@ const char *LibrarySystem::GetFileExtension(const char *filename)
return NULL;
}
bool LibrarySystem::CreateDirectory(const char *path)
bool LibrarySystem::CreateFolder(const char *path)
{
#if defined PLATFORM_WINDOWS
return (mkdir(path) != -1);

View File

@ -75,7 +75,7 @@ public:
void GetPlatformError(char *error, size_t maxlength);
size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
const char *GetFileExtension(const char *filename);
bool CreateDirectory(const char *path);
bool CreateFolder(const char *path);
size_t GetFileFromPath(char *buffer, size_t maxlength, const char *path);
};

View File

@ -29,7 +29,7 @@
namespace SourceMod
{
#define SMINTERFACE_LIBRARYSYS_NAME "ILibrarySys"
#define SMINTERFACE_LIBRARYSYS_VERSION 2
#define SMINTERFACE_LIBRARYSYS_VERSION 3
class ILibrary
{
@ -181,6 +181,14 @@ namespace SourceMod
* @return Pointer to file extension.
*/
virtual const char *GetFileExtension(const char *filename) =0;
/**
* @brief Creates a directory.
*
* @param path Full, absolute path of the directory to create.
* @return True on success, false otherwise.
*/
virtual bool CreateFolder(const char *path) =0;
};
}

View File

@ -55,5 +55,6 @@
//#define SMEXT_ENABLE_GAMEHELPERS
//#define SMEXT_ENABLE_TIMERSYS
//#define SMEXT_ENABLE_THREADER
//#define SMEXT_ENABLE_LIBSYS
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_

View File

@ -63,6 +63,9 @@ IADTFactory *adtfactory = NULL;
#if defined SMEXT_ENABLE_THREADER
IThreader *threader = NULL;
#endif
#if defined SMEXT_ENABLE_LIBSYS
ILibrarySys *libsys = NULL;
#endif
/** Exports the main interface */
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
@ -130,6 +133,9 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
#if defined SMEXT_ENABLE_THREADER
SM_GET_IFACE(THREADER, threader);
#endif
#if defined SMEXT_ENABLE_LIBSYS
SM_GET_IFACE(LIBRARYSYS, libsys);
#endif
if (SDK_OnLoad(error, maxlength, late))
{

View File

@ -57,6 +57,9 @@
#if defined SMEXT_ENABLE_THREADER
#include <IThreader.h>
#endif
#if defined SMEXT_ENABLE_LIBSYS
#include <ILibrarySys.h>
#endif
#if defined SMEXT_CONF_METAMOD
#include <ISmmPlugin.h>
@ -237,6 +240,9 @@ extern IADTFactory *adtfactory;
#if defined SMEXT_ENABLE_THREADER
extern IThreader *threader;
#endif
#if defined SMEXT_ENABLE_LIBSYS
extern ILibrarySys *libsys;
#endif
#if defined SMEXT_CONF_METAMOD
PLUGIN_GLOBALVARS();