diff --git a/core/CoreConfig.cpp b/core/CoreConfig.cpp index 442d0870..199ecbf9 100644 --- a/core/CoreConfig.cpp +++ b/core/CoreConfig.cpp @@ -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; } diff --git a/core/systems/LibrarySys.cpp b/core/systems/LibrarySys.cpp index dbd5cd65..1e2ce391 100644 --- a/core/systems/LibrarySys.cpp +++ b/core/systems/LibrarySys.cpp @@ -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); diff --git a/core/systems/LibrarySys.h b/core/systems/LibrarySys.h index dd38b428..bb9da7c8 100644 --- a/core/systems/LibrarySys.h +++ b/core/systems/LibrarySys.h @@ -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); }; diff --git a/public/ILibrarySys.h b/public/ILibrarySys.h index d8e2c407..1232fecf 100644 --- a/public/ILibrarySys.h +++ b/public/ILibrarySys.h @@ -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; }; } diff --git a/public/sample_ext/sdk/smsdk_config.h b/public/sample_ext/sdk/smsdk_config.h index 2d563ab4..d530e4c5 100644 --- a/public/sample_ext/sdk/smsdk_config.h +++ b/public/sample_ext/sdk/smsdk_config.h @@ -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_ diff --git a/public/sample_ext/sdk/smsdk_ext.cpp b/public/sample_ext/sdk/smsdk_ext.cpp index 675f28b4..c6bf694d 100644 --- a/public/sample_ext/sdk/smsdk_ext.cpp +++ b/public/sample_ext/sdk/smsdk_ext.cpp @@ -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)) { diff --git a/public/sample_ext/sdk/smsdk_ext.h b/public/sample_ext/sdk/smsdk_ext.h index 757f4163..1615b9ee 100644 --- a/public/sample_ext/sdk/smsdk_ext.h +++ b/public/sample_ext/sdk/smsdk_ext.h @@ -57,6 +57,9 @@ #if defined SMEXT_ENABLE_THREADER #include #endif +#if defined SMEXT_ENABLE_LIBSYS +#include +#endif #if defined SMEXT_CONF_METAMOD #include @@ -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();