os_unix: Use libuv uv_cwd instead of getcwd/getwd.

This commit is contained in:
Thomas Wienecke 2014-02-25 17:03:04 +01:00 committed by Thiago de Arruda
parent d342257ae4
commit 1e2da25d3d
8 changed files with 19 additions and 19 deletions

View File

@ -12,6 +12,7 @@
*/
#include "vim.h"
#include "os/os.h"

View File

@ -12,6 +12,7 @@
*/
#include "vim.h"
#include "os/os.h"
#if defined(HAVE_UTIME) && defined(HAVE_UTIME_H)

View File

@ -12,6 +12,7 @@
*/
#include "vim.h"
#include "os/os.h"
/*
* This file contains routines to maintain and manipulate marks.

View File

@ -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;
}

View File

@ -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

View File

@ -1244,24 +1244,6 @@ static char * strerror(int err)
}
#endif
/*
* 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)
{
#if defined(USE_GETCWD)
if (getcwd((char *)buf, len) == NULL) {
STRCPY(buf, strerror(errno));
return FAIL;
}
return OK;
#else
return getwd((char *)buf) != NULL ? OK : FAIL;
#endif
}
/*
* Get absolute file name into "buf[len]".
*

View File

@ -27,7 +27,6 @@ int mch_get_user_name __ARGS((char_u *s, int len));
int mch_get_uname __ARGS((uid_t uid, char_u *s, int len));
void mch_get_host_name __ARGS((char_u *s, int len));
long mch_get_pid __ARGS((void));
int mch_dirname __ARGS((char_u *buf, int len));
void slash_adjust __ARGS((char_u *p));
int mch_FullName __ARGS((char_u *fname, char_u *buf, int len, int force));
int mch_isFullName __ARGS((char_u *fname));

View File

@ -12,6 +12,7 @@
*/
#include "vim.h"
#include "os/os.h"
struct dir_stack_T {