diff options
Diffstat (limited to 'src/os')
| -rw-r--r-- | src/os/fs.c | 25 | ||||
| -rw-r--r-- | src/os/os.h | 15 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/os/fs.c b/src/os/fs.c index a68e66ef00..f9b02375e1 100644 --- a/src/os/fs.c +++ b/src/os/fs.c @@ -202,3 +202,28 @@ int os_rename(const char_u *path, const char_u *new_path) return FAIL; } + +int os_mkdir(const char *path, int32_t mode) +{ + uv_fs_t request; + int result = uv_fs_mkdir(uv_default_loop(), &request, path, mode, NULL); + uv_fs_req_cleanup(&request); + return result; +} + +int os_rmdir(const char *path) +{ + uv_fs_t request; + int result = uv_fs_rmdir(uv_default_loop(), &request, path, NULL); + uv_fs_req_cleanup(&request); + return result; +} + +int os_remove(const char *path) +{ + uv_fs_t request; + int result = uv_fs_unlink(uv_default_loop(), &request, path, NULL); + uv_fs_req_cleanup(&request); + return result; +} + diff --git a/src/os/os.h b/src/os/os.h index ff21a95f3a..45bec739f5 100644 --- a/src/os/os.h +++ b/src/os/os.h @@ -63,6 +63,21 @@ int os_file_is_writable(const char *name); /// @return `OK` for success, `FAIL` for failure. int os_rename(const char_u *path, const char_u *new_path); +/// Make a directory. +/// +/// @return `0` for success, non-zero for failure. +int os_mkdir(const char *path, int32_t mode); + +/// Remove a directory. +/// +/// @return `0` for success, non-zero for failure. +int os_rmdir(const char *path); + +/// Remove a file. +/// +/// @return `0` for success, non-zero for failure. +int os_remove(const char *path); + long_u os_total_mem(int special); const char *os_getenv(const char *name); int os_setenv(const char *name, const char *value, int overwrite); |