1 #ifndef _INCLUDE_SOURCEMOD_SYSTEM_LIBRARY_H_
2 #define _INCLUDE_SOURCEMOD_SYSTEM_LIBRARY_H_
4 #include <ILibrarySys.h>
5 #include "sm_platform.h"
7 using namespace SourceMod;
9 #if defined PLATFORM_WINDOWS
10 typedef HMODULE LibraryHandle;
11 #else if defined PLATFORM_POSIX
12 typedef void * LibraryHandle;
15 class CDirectory : public IDirectory
18 CDirectory(const char *path);
21 virtual bool MoreFiles();
22 virtual void NextEntry();
23 virtual const char *GetEntryName();
24 virtual bool IsEntryDirectory();
25 virtual bool IsEntryFile();
26 virtual bool IsEntryValid();
30 #if defined PLATFORM_WINDOWS
32 WIN32_FIND_DATAA m_fd;
33 #else if defined PLATFORM_LINUX
36 char m_origpath[PLATFORM_MAX_PATH];
40 class CLibrary : public ILibrary
43 CLibrary(LibraryHandle me);
46 virtual void CloseLibrary();
47 virtual void *GetSymbolAddress(const char *symname);
52 class LibrarySystem : public ILibrarySys
55 virtual ILibrary *OpenLibrary(const char *path, char *error, size_t err_max);
56 virtual IDirectory *OpenDirectory(const char *path);
57 virtual void CloseDirectory(IDirectory *dir);
58 virtual bool PathExists(const char *path);
59 virtual bool IsPathFile(const char *path);
60 virtual bool IsPathDirectory(const char *path);
61 virtual void GetPlatformError(char *error, size_t err_max);
62 virtual void PathFormat(char *buffer, size_t len, const char *fmt, ...);
65 extern LibrarySystem g_LibSys;
67 #endif //_INCLUDE_SOURCEMOD_SYSTEM_LIBRARY_H_