mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 01:16:31 +00:00
vim-patch:7.4.1114
Problem: delete() does not work well with symbolic links.
Solution: Recognize symbolik links.
43a34f9f74
This commit is contained in:
@@ -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.
|
||||
|
@@ -63,7 +63,7 @@ int delete_recursive(char_u *name)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (os_isdir(name)) {
|
||||
if (os_isrealdir(name)) {
|
||||
snprintf((char *)NameBuff, MAXPATHL, "%s/*", name);
|
||||
|
||||
char_u **files;
|
||||
|
@@ -250,7 +250,7 @@ static int included_patches[] = {
|
||||
// 1117,
|
||||
// 1116,
|
||||
// 1115 NA
|
||||
// 1114,
|
||||
1114,
|
||||
1113,
|
||||
1112,
|
||||
// 1111,
|
||||
|
Reference in New Issue
Block a user