aboutsummaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorStefan Hoffmann <stefan991@gmail.com>2014-05-02 20:08:36 +0200
committerStefan Hoffmann <stefan991@gmail.com>2014-05-09 15:49:33 +0200
commit8e8dae71da51f068243ecda05bc250d59918f15b (patch)
tree18c3c1052dcb1cfc32d32ef232e76b30db9b2369 /src/eval.c
parent902ad8d94d9a1eafde858793587037e620c6ee6f (diff)
downloadrneovim-8e8dae71da51f068243ecda05bc250d59918f15b.tar.gz
rneovim-8e8dae71da51f068243ecda05bc250d59918f15b.tar.bz2
rneovim-8e8dae71da51f068243ecda05bc250d59918f15b.zip
replaced some mch_lstat()
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/eval.c b/src/eval.c
index 80135305c6..9300b9a77b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -9729,44 +9729,45 @@ static void f_getftime(typval_T *argvars, typval_T *rettv)
static void f_getftype(typval_T *argvars, typval_T *rettv)
{
char_u *fname;
- struct stat st;
char_u *type = NULL;
char *t;
fname = get_tv_string(&argvars[0]);
rettv->v_type = VAR_STRING;
- if (mch_lstat((char *)fname, &st) >= 0) {
+ FileInfo file_info;
+ if (os_get_file_info_link((char *)fname, &file_info)) {
+ uint64_t mode = file_info.stat.st_mode;
#ifdef S_ISREG
- if (S_ISREG(st.st_mode))
+ if (S_ISREG(mode))
t = "file";
- else if (S_ISDIR(st.st_mode))
+ else if (S_ISDIR(mode))
t = "dir";
# ifdef S_ISLNK
- else if (S_ISLNK(st.st_mode))
+ else if (S_ISLNK(mode))
t = "link";
# endif
# ifdef S_ISBLK
- else if (S_ISBLK(st.st_mode))
+ else if (S_ISBLK(mode))
t = "bdev";
# endif
# ifdef S_ISCHR
- else if (S_ISCHR(st.st_mode))
+ else if (S_ISCHR(mode))
t = "cdev";
# endif
# ifdef S_ISFIFO
- else if (S_ISFIFO(st.st_mode))
+ else if (S_ISFIFO(mode))
t = "fifo";
# endif
# ifdef S_ISSOCK
- else if (S_ISSOCK(st.st_mode))
+ else if (S_ISSOCK(mode))
t = "fifo";
# endif
else
t = "other";
#else
# ifdef S_IFMT
- switch (st.st_mode & S_IFMT) {
+ switch (mode & S_IFMT) {
case S_IFREG: t = "file"; break;
case S_IFDIR: t = "dir"; break;
# ifdef S_IFLNK