diff options
author | Justin Gassner <justin.gassner@web.de> | 2016-01-25 19:36:57 +0100 |
---|---|---|
committer | Justin Gassner <justin.gassner@web.de> | 2016-01-25 21:45:26 +0100 |
commit | 299044d4efff0f3ea0ae910977ebe77099cfebf4 (patch) | |
tree | b31b8baec4752be50cf6fc270092b85c768a7202 /src/nvim/path.c | |
parent | 45b378259ebc66530cfa2a3fdb2504f17a185a22 (diff) | |
download | rneovim-299044d4efff0f3ea0ae910977ebe77099cfebf4.tar.gz rneovim-299044d4efff0f3ea0ae910977ebe77099cfebf4.tar.bz2 rneovim-299044d4efff0f3ea0ae910977ebe77099cfebf4.zip |
vim-patch:7.4.656
Problem: Missing changes for glob() in one file.
Solution: Add the missing changes.
https://github.com/vim/vim/commit/d8b77f7dc04e5721989df9c505b8568194261a39
Diffstat (limited to 'src/nvim/path.c')
-rw-r--r-- | src/nvim/path.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index 5ac3d07f67..8b9a49dfc0 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -681,11 +681,16 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, /* remove backslashes for the remaining components only */ (void)do_path_expand(gap, buf, len + 1, flags, false); } else { - /* no more wildcards, check if there is a match */ - /* remove backslashes for the remaining components only */ - if (*path_end != NUL) + FileInfo file_info; + + // no more wildcards, check if there is a match + // remove backslashes for the remaining components only + if (*path_end != NUL) { backslash_halve(buf + len + 1); - if (os_file_exists(buf)) { /* add existing file */ + } + // add existing file or symbolic link + if ((flags & EW_ALLLINKS) ? os_fileinfo_link((char *)buf, &file_info) + : os_file_exists(buf)) { addfile(gap, buf, flags); } } @@ -1294,26 +1299,28 @@ expand_backtick ( return cnt; } -/* - * Add a file to a file list. Accepted flags: - * EW_DIR add directories - * EW_FILE add files - * EW_EXEC add executable files - * EW_NOTFOUND add even when it doesn't exist - * EW_ADDSLASH add slash after directory name - */ -void -addfile ( +// Add a file to a file list. Accepted flags: +// EW_DIR add directories +// EW_FILE add files +// EW_EXEC add executable files +// EW_NOTFOUND add even when it doesn't exist +// EW_ADDSLASH add slash after directory name +// EW_ALLLINKS add symlink also when the referred file does not exist +void addfile( garray_T *gap, char_u *f, /* filename */ int flags ) { bool isdir; + FileInfo file_info; - /* if the file/dir doesn't exist, may not add it */ - if (!(flags & EW_NOTFOUND) && !os_file_exists(f)) + // if the file/dir/link doesn't exist, may not add it + if (!(flags & EW_NOTFOUND) && + ((flags & EW_ALLLINKS) ? + !os_fileinfo_link((char *)f, &file_info) : !os_file_exists(f))) { return; + } #ifdef FNAME_ILLEGAL /* if the file/dir contains illegal characters, don't add it */ |