aboutsummaryrefslogtreecommitdiff
path: root/src/os/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/fs.c')
-rw-r--r--src/os/fs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/os/fs.c b/src/os/fs.c
index 4c1b05b678..aa19b2f7f7 100644
--- a/src/os/fs.c
+++ b/src/os/fs.c
@@ -315,3 +315,20 @@ int mch_setperm(const char_u *name, int perm)
return OK;
}
}
+
+/*
+ * return TRUE if "name" exists.
+ */
+int os_file_exists(char_u *name)
+{
+ uv_fs_t request;
+ int result = uv_fs_stat(uv_default_loop(), &request, (const char*) name, NULL);
+ uv_fs_req_cleanup(&request);
+
+ if (result != 0) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+