diff options
author | Stefan Hoffmann <stefan991@gmail.com> | 2014-04-08 20:46:42 +0200 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-11 13:31:48 -0300 |
commit | 445f31f076325a68d91746bb41ac9ba139144c2d (patch) | |
tree | dd05a6d09822572ae152be6b3759696d8ebf6901 /src/os | |
parent | 136e5e5b84469559e72e061b2c6e78db18174a12 (diff) | |
download | rneovim-445f31f076325a68d91746bb41ac9ba139144c2d.tar.gz rneovim-445f31f076325a68d91746bb41ac9ba139144c2d.tar.bz2 rneovim-445f31f076325a68d91746bb41ac9ba139144c2d.zip |
port vim_mkdir, mch_rmdir and mch_remove to libuv
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); |