Added remove directory method to File.

git-svn-id: http://voip.null.ro/svn/yate@2608 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2009-05-01 14:42:12 +00:00
parent e972af3bc5
commit 9e303b3fe0
2 changed files with 23 additions and 0 deletions

View File

@ -1022,6 +1022,21 @@ bool File::mkDir(const char* path, int* error)
return getLastError(error);
}
// Remove an empty folder (directory)
bool File::rmDir(const char* path, int* error)
{
if (!fileNameOk(path,error))
return false;
#ifdef _WINDOWS
if (::RemoveDirectoryA(path))
return true;
#else
if (0 == ::rmdir(path))
return true;
#endif
return getLastError(error);
}
// Skip special directories (. or ..)
static inline bool skipSpecial(const char* s)
{

View File

@ -4671,6 +4671,14 @@ public:
*/
static bool mkDir(const char* path, int* error = 0);
/**
* Remove an empty folder (directory)
* @param path The folder path
* @param error Optional pointer to error code to be filled on failure
* @return True on success
*/
static bool rmDir(const char* path, int* error = 0);
/**
* Enumerate a folder (directory) content.
* Fill the given lists with children item names