diff options
Diffstat (limited to 'src/os')
| -rw-r--r-- | src/os/fs.c | 14 | ||||
| -rw-r--r-- | src/os/os.h | 1 |
2 files changed, 15 insertions, 0 deletions
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 |