libobs/util: Add os_rmdir function

Adds a function to remove a directory.
This commit is contained in:
jp9000
2015-06-29 00:39:21 -07:00
parent 50f4793c99
commit 216baaf799
3 changed files with 21 additions and 0 deletions

View File

@@ -296,6 +296,11 @@ int os_unlink(const char *path)
return unlink(path);
}
int os_rmdir(const char *path)
{
return rmdir(path);
}
int os_mkdir(const char *path)
{
if (mkdir(path, 0777) == 0)

View File

@@ -395,6 +395,21 @@ int os_unlink(const char *path)
return success ? 0 : -1;
}
int os_rmdir(const char *path)
{
wchar_t *w_path;
bool success;
os_utf8_to_wcs_ptr(path, 0, &w_path);
if (!w_path)
return -1;
success = !!RemoveDirectoryW(w_path);
bfree(w_path);
return success ? 0 : -1;
}
int os_mkdir(const char *path)
{
wchar_t *path_utf16;

View File

@@ -128,6 +128,7 @@ EXPORT int os_glob(const char *pattern, int flags, os_glob_t **pglob);
EXPORT void os_globfree(os_glob_t *pglob);
EXPORT int os_unlink(const char *path);
EXPORT int os_rmdir(const char *path);
#define MKDIR_EXISTS 1
#define MKDIR_SUCCESS 0