diff options
Diffstat (limited to '')
-rw-r--r-- | src/filepath.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/filepath.c b/src/filepath.c index 9f68d7c..d514aaf 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -3645,11 +3645,15 @@ dos_expandpath( } else { + stat_T sb; + // no more wildcards, check if there is a match // remove backslashes for the remaining components only if (*path_end != 0) backslash_halve(buf + len + 1); - if (mch_getperm(buf) >= 0) // add existing file + // add existing file + if ((flags & EW_ALLLINKS) ? mch_lstat((char *)buf, &sb) >= 0 + : mch_getperm(buf) >= 0) addfile(gap, buf, flags); } } @@ -3999,6 +4003,8 @@ gen_expand_wildcards( int add_pat; int retval = OK; int did_expand_in_path = FALSE; + char_u *path_option = *curbuf->b_p_path == NUL ? + p_path : curbuf->b_p_path; /* * expand_env() is called to expand things like "~user". If this fails, @@ -4088,7 +4094,7 @@ gen_expand_wildcards( */ if (mch_has_exp_wildcard(p) || (flags & EW_ICASE)) { - if ((flags & EW_PATH) + if ((flags & (EW_PATH | EW_CDPATH)) && !mch_isFullName(p) && !(p[0] == '.' && (vim_ispathsep(p[1]) @@ -4122,8 +4128,8 @@ gen_expand_wildcards( vim_free(t); } - if (did_expand_in_path && ga.ga_len > 0 && (flags & EW_PATH)) - uniquefy_paths(&ga, p); + if (did_expand_in_path && ga.ga_len > 0 && (flags & (EW_PATH | EW_CDPATH))) + uniquefy_paths(&ga, p, path_option); if (p != pat[i]) vim_free(p); } |