began platform support
initial import of platform library code tested on win32 --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40146
This commit is contained in:
@@ -10,6 +10,11 @@ namespace SourceMod
|
||||
|
||||
class ILibrary
|
||||
{
|
||||
public:
|
||||
virtual ~ILibrary()
|
||||
{
|
||||
/* Calling delete will call CloseLibrary! */
|
||||
};
|
||||
public:
|
||||
/**
|
||||
* @brief Closes dynamic library and invalidates pointer.
|
||||
@@ -30,6 +35,10 @@ namespace SourceMod
|
||||
*/
|
||||
class IDirectory
|
||||
{
|
||||
public:
|
||||
virtual ~IDirectory()
|
||||
{
|
||||
}
|
||||
public:
|
||||
/**
|
||||
* @brief Returns true if there are more files to read, false otherwise.
|
||||
@@ -90,7 +99,7 @@ namespace SourceMod
|
||||
* @param err_max Maximum length of error buffer.
|
||||
* @return Pointer to an IDirectory, NULL if failed.
|
||||
*/
|
||||
virtual IDirectory *OpenDirectory(const char *path, char *error, size_t err_max) =0;
|
||||
virtual IDirectory *OpenDirectory(const char *path) =0;
|
||||
|
||||
/**
|
||||
* @brief Closes a directory and frees its handle.
|
||||
@@ -99,6 +108,11 @@ namespace SourceMod
|
||||
*/
|
||||
virtual void CloseDirectory(IDirectory *dir) =0;
|
||||
|
||||
/**
|
||||
* @brief Returns true if a path exists.
|
||||
*/
|
||||
virtual bool PathExists(const char *path) =0;
|
||||
|
||||
/**
|
||||
* @brief Returns true if the path is a normal file.
|
||||
*/
|
||||
@@ -108,6 +122,17 @@ namespace SourceMod
|
||||
* @brief Returns true if the path is a normal directory.
|
||||
*/
|
||||
virtual bool IsPathDirectory(const char *path) =0;
|
||||
|
||||
/**
|
||||
* @brief Gets a platform-specific error message.
|
||||
* This should only be called when an ILibrary function fails.
|
||||
* Win32 equivalent: GetLastError() + FormatMessage()
|
||||
* POSIX equivalent: errno + strerror()
|
||||
*
|
||||
* @param error Error message buffer.
|
||||
* @param err_max Maximum length of error buffer.
|
||||
*/
|
||||
virtual void GetPlatformError(char *error, size_t err_max) =0;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user