3 * ===============================================================
4 * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
5 * ===============================================================
7 * This file is not open source and may not be copied without explicit
8 * written permission of AlliedModders LLC. This file may not be redistributed
9 * in whole or significant part.
10 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
15 #ifndef _INCLUDE_SOURCEMOD_SYSTEM_LIBRARY_H_
16 #define _INCLUDE_SOURCEMOD_SYSTEM_LIBRARY_H_
18 #include <ILibrarySys.h>
19 #include "sm_platform.h"
21 using namespace SourceMod;
23 #if defined PLATFORM_WINDOWS
24 typedef HMODULE LibraryHandle;
25 #elif defined PLATFORM_POSIX
26 typedef void * LibraryHandle;
29 class CDirectory : public IDirectory
32 CDirectory(const char *path);
37 const char *GetEntryName();
38 bool IsEntryDirectory();
44 #if defined PLATFORM_WINDOWS
46 WIN32_FIND_DATAA m_fd;
47 #elif defined PLATFORM_POSIX
50 char m_origpath[PLATFORM_MAX_PATH];
54 class CLibrary : public ILibrary
57 CLibrary(LibraryHandle me);
61 void *GetSymbolAddress(const char *symname);
66 class LibrarySystem : public ILibrarySys
69 ILibrary *OpenLibrary(const char *path, char *error, size_t maxlength);
70 IDirectory *OpenDirectory(const char *path);
71 void CloseDirectory(IDirectory *dir);
72 bool PathExists(const char *path);
73 bool IsPathFile(const char *path);
74 bool IsPathDirectory(const char *path);
75 void GetPlatformError(char *error, size_t maxlength);
76 size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
77 const char *GetFileExtension(const char *filename);
78 bool CreateDirectory(const char *path);
79 size_t GetFileFromPath(char *buffer, size_t maxlength, const char *path);
82 extern LibrarySystem g_LibSys;
84 #endif //_INCLUDE_SOURCEMOD_SYSTEM_LIBRARY_H_