aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-04-22 04:11:45 -0400
committerJustin M. Keyes <justinkz@gmail.com>2016-04-22 04:11:45 -0400
commit3d7a6e4d54cbb6cb3cd7e35b604b956de9f0c950 (patch)
treebe1e44070b1165ff920cea369847c548b8e7dea6 /src/nvim/os
parentc4de9c7cc9fffa1402b362653484a14799d8cd03 (diff)
parent9e1cacecbe2938c45205fdb30465303dfe2af968 (diff)
downloadrneovim-3d7a6e4d54cbb6cb3cd7e35b604b956de9f0c950.tar.gz
rneovim-3d7a6e4d54cbb6cb3cd7e35b604b956de9f0c950.tar.bz2
rneovim-3d7a6e4d54cbb6cb3cd7e35b604b956de9f0c950.zip
Merge pull request #4367 from jbradaric/vim-7.4.1107
vim-patch:7.4.{1107,1114,1116,1117,1120}
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/fs.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 34d8fde4f1..bc2d37764d 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -59,6 +59,23 @@ int os_dirname(char_u *buf, size_t len)
return OK;
}
+/// Check if the given path is a directory and not a symlink to a directory.
+/// @return `true` if `name` is a directory and NOT a symlink to a directory.
+/// `false` if `name` is not a directory or if an error occurred.
+bool os_isrealdir(const char_u *name)
+ FUNC_ATTR_NONNULL_ALL
+{
+ uv_fs_t request;
+ if (uv_fs_lstat(&fs_loop, &request, (char *)name, NULL) != kLibuvSuccess) {
+ return false;
+ }
+ if (S_ISLNK(request.statbuf.st_mode)) {
+ return false;
+ } else {
+ return S_ISDIR(request.statbuf.st_mode);
+ }
+}
+
/// Check if the given path is a directory or not.
///
/// @return `true` if `fname` is a directory.