aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/fs.c
diff options
context:
space:
mode:
authorSaid Al Attrach <alattrach.said@yahoo.com>2019-03-10 18:08:45 +0100
committerSaid Al Attrach <alattrach.said@yahoo.com>2019-03-10 18:11:30 +0100
commit8410c72b18b0c2d8cfbf98e57e2ab8869dd6af01 (patch)
tree5919dc242c74fc9d3084e841d1b12c0077d6ca6e /src/nvim/os/fs.c
parentef5037e7f6e199ade4475d819842e66eb3bd8381 (diff)
downloadrneovim-8410c72b18b0c2d8cfbf98e57e2ab8869dd6af01.tar.gz
rneovim-8410c72b18b0c2d8cfbf98e57e2ab8869dd6af01.tar.bz2
rneovim-8410c72b18b0c2d8cfbf98e57e2ab8869dd6af01.zip
fs: add os_copy function that uses uv_fs_copyfile
Diffstat (limited to 'src/nvim/os/fs.c')
-rw-r--r--src/nvim/os/fs.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 27db675c52..81d3b0a2e9 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -643,6 +643,20 @@ ptrdiff_t os_write(const int fd, const char *const buf, const size_t size,
return (ptrdiff_t)written_bytes;
}
+/// Copies a file from path to new_path. Currently this passes
+/// the arguments through to uv_fs_copyfile.
+///
+/// @param path Path of file to be copied
+/// @param path_new Path of new file
+/// @param flags Bitwise OR of flags defined in <uv.h>
+/// @return libuv error code on error
+int os_copy(const char *path, const char *new_path, int flags)
+{
+ int r;
+ RUN_UV_FS_FUNC(r, uv_fs_copyfile, path, new_path, flags, NULL);
+ return r;
+}
+
/// Flushes file modifications to disk.
///
/// @param fd the file descriptor of the file to flush to disk.