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:
parent
fa07c9d8a2
commit
1154b20fc9
@ -200,7 +200,7 @@ bool SM_ExecuteConfig(CPlugin *pl, AutoConfig *cfg, bool can_create)
|
|||||||
sizeof(build)-len,
|
sizeof(build)-len,
|
||||||
"/%s",
|
"/%s",
|
||||||
cur_ptr);
|
cur_ptr);
|
||||||
if (!g_LibSys.CreateDirectory(build))
|
if (!g_LibSys.CreateFolder(build))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ const char *LibrarySystem::GetFileExtension(const char *filename)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LibrarySystem::CreateDirectory(const char *path)
|
bool LibrarySystem::CreateFolder(const char *path)
|
||||||
{
|
{
|
||||||
#if defined PLATFORM_WINDOWS
|
#if defined PLATFORM_WINDOWS
|
||||||
return (mkdir(path) != -1);
|
return (mkdir(path) != -1);
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
void GetPlatformError(char *error, size_t maxlength);
|
void GetPlatformError(char *error, size_t maxlength);
|
||||||
size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
|
size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
|
||||||
const char *GetFileExtension(const char *filename);
|
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);
|
size_t GetFileFromPath(char *buffer, size_t maxlength, const char *path);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
namespace SourceMod
|
namespace SourceMod
|
||||||
{
|
{
|
||||||
#define SMINTERFACE_LIBRARYSYS_NAME "ILibrarySys"
|
#define SMINTERFACE_LIBRARYSYS_NAME "ILibrarySys"
|
||||||
#define SMINTERFACE_LIBRARYSYS_VERSION 2
|
#define SMINTERFACE_LIBRARYSYS_VERSION 3
|
||||||
|
|
||||||
class ILibrary
|
class ILibrary
|
||||||
{
|
{
|
||||||
@ -181,6 +181,14 @@ namespace SourceMod
|
|||||||
* @return Pointer to file extension.
|
* @return Pointer to file extension.
|
||||||
*/
|
*/
|
||||||
virtual const char *GetFileExtension(const char *filename) =0;
|
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;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,5 +55,6 @@
|
|||||||
//#define SMEXT_ENABLE_GAMEHELPERS
|
//#define SMEXT_ENABLE_GAMEHELPERS
|
||||||
//#define SMEXT_ENABLE_TIMERSYS
|
//#define SMEXT_ENABLE_TIMERSYS
|
||||||
//#define SMEXT_ENABLE_THREADER
|
//#define SMEXT_ENABLE_THREADER
|
||||||
|
//#define SMEXT_ENABLE_LIBSYS
|
||||||
|
|
||||||
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
#endif // _INCLUDE_SOURCEMOD_EXTENSION_CONFIG_H_
|
||||||
|
@ -63,6 +63,9 @@ IADTFactory *adtfactory = NULL;
|
|||||||
#if defined SMEXT_ENABLE_THREADER
|
#if defined SMEXT_ENABLE_THREADER
|
||||||
IThreader *threader = NULL;
|
IThreader *threader = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
|
ILibrarySys *libsys = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Exports the main interface */
|
/** Exports the main interface */
|
||||||
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
|
||||||
@ -130,6 +133,9 @@ bool SDKExtension::OnExtensionLoad(IExtension *me, IShareSys *sys, char *error,
|
|||||||
#if defined SMEXT_ENABLE_THREADER
|
#if defined SMEXT_ENABLE_THREADER
|
||||||
SM_GET_IFACE(THREADER, threader);
|
SM_GET_IFACE(THREADER, threader);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
|
SM_GET_IFACE(LIBRARYSYS, libsys);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDK_OnLoad(error, maxlength, late))
|
if (SDK_OnLoad(error, maxlength, late))
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,9 @@
|
|||||||
#if defined SMEXT_ENABLE_THREADER
|
#if defined SMEXT_ENABLE_THREADER
|
||||||
#include <IThreader.h>
|
#include <IThreader.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
|
#include <ILibrarySys.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined SMEXT_CONF_METAMOD
|
#if defined SMEXT_CONF_METAMOD
|
||||||
#include <ISmmPlugin.h>
|
#include <ISmmPlugin.h>
|
||||||
@ -237,6 +240,9 @@ extern IADTFactory *adtfactory;
|
|||||||
#if defined SMEXT_ENABLE_THREADER
|
#if defined SMEXT_ENABLE_THREADER
|
||||||
extern IThreader *threader;
|
extern IThreader *threader;
|
||||||
#endif
|
#endif
|
||||||
|
#if defined SMEXT_ENABLE_LIBSYS
|
||||||
|
extern ILibrarySys *libsys;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined SMEXT_CONF_METAMOD
|
#if defined SMEXT_CONF_METAMOD
|
||||||
PLUGIN_GLOBALVARS();
|
PLUGIN_GLOBALVARS();
|
||||||
|
Loading…
Reference in New Issue
Block a user