Adds a function to remove a directory.
@@ -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)
@@ -395,6 +395,21 @@ int os_unlink(const char *path)
return success ? 0 : -1;
+ 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;
wchar_t *path_utf16;
@@ -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