summaryrefslogtreecommitdiffstats
path: root/src/filepath.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:05:15 +0000
commit6e9cd6b491267e6dff3e3f3f37d8af5f28e40672 (patch)
tree35661af16c4a0ef2a9a8e225d2d5cc82605ea289 /src/filepath.c
parentAdding upstream version 2:9.1.0496. (diff)
downloadvim-6e9cd6b491267e6dff3e3f3f37d8af5f28e40672.tar.xz
vim-6e9cd6b491267e6dff3e3f3f37d8af5f28e40672.zip
Adding upstream version 2:9.1.0698.upstream/2%9.1.0698
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/filepath.c14
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);
}