From 1e2da25d3da075c87fababccae0c58d6ffa7df21 Mon Sep 17 00:00:00 2001 From: Thomas Wienecke Date: Tue, 25 Feb 2014 17:03:04 +0100 Subject: os_unix: Use libuv uv_cwd instead of getcwd/getwd. --- src/os/fs.c | 14 ++++++++++++++ src/os/os.h | 1 + 2 files changed, 15 insertions(+) (limited to 'src/os') diff --git a/src/os/fs.c b/src/os/fs.c index 358b07e57b..e9a76c6b79 100644 --- a/src/os/fs.c +++ b/src/os/fs.c @@ -23,3 +23,17 @@ int mch_chdir(char *path) { } return uv_chdir(path); } + +/* + * Get name of current directory into buffer 'buf' of length 'len' bytes. + * Return OK for success, FAIL for failure. + */ +int mch_dirname(char_u *buf, int len) +{ + int errno; + if ((errno = uv_cwd((char *)buf, len)) != 0) { + STRCPY(buf, uv_strerror(errno)); + return FAIL; + } + return OK; +} diff --git a/src/os/os.h b/src/os/os.h index 58d49d36e7..099f53312f 100644 --- a/src/os/os.h +++ b/src/os/os.h @@ -5,5 +5,6 @@ long_u mch_total_mem(int special); int mch_chdir(char *path); +int mch_dirname(char_u *buf, int len); #endif -- cgit