summaryrefslogtreecommitdiff
path: root/src/misc2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-07-03 17:14:00 +0200
committerBram Moolenaar <Bram@vim.org>2013-07-03 17:14:00 +0200
commitf4c5fcb3ad0b98d6827d5f95e5c66cdd54e66a02 (patch)
treeb90fb10d1d9e99ac323b2b6469a84ebbf5f98d44 /src/misc2.c
parent8968a31179c8142cc4ccc2f27cf09e03135c35c7 (diff)
downloadvim-git-f4c5fcb3ad0b98d6827d5f95e5c66cdd54e66a02.tar.gz
updated for version 7.3.1297v7.3.1297
Problem: findfile() directory matching does not work when a star follows text. (Markus Braun) Solution: Make a wildcard work properly. (Christian Brabandt)
Diffstat (limited to 'src/misc2.c')
-rw-r--r--src/misc2.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/src/misc2.c b/src/misc2.c
index 196641fad..c63344f0d 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -4679,8 +4679,58 @@ vim_findfile_init(path, filename, stopdirs, level, free_visited, find_what,
}
STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
add_pathsep(ff_expand_buffer);
- STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
- add_pathsep(ff_expand_buffer);
+ {
+ char_u *buf = alloc(STRLEN(ff_expand_buffer)
+ + STRLEN(search_ctx->ffsc_fix_path));
+
+ STRCPY(buf, ff_expand_buffer);
+ STRCAT(buf, search_ctx->ffsc_fix_path);
+ if (mch_isdir(buf))
+ {
+ STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
+ add_pathsep(ff_expand_buffer);
+ }
+#ifdef FEAT_PATH_EXTRA
+ else
+ {
+ char_u *p = vim_strrchr(search_ctx->ffsc_fix_path, PATHSEP);
+ char_u *wc_path = NUL;
+ char_u *temp = NUL;
+ int len = 0;
+
+ if (p != NULL)
+ {
+ len = p - search_ctx->ffsc_fix_path;
+ STRNCAT(ff_expand_buffer, search_ctx->ffsc_fix_path, len);
+ add_pathsep(ff_expand_buffer);
+ }
+ else
+ len = STRLEN(search_ctx->ffsc_fix_path);
+
+ if (search_ctx->ffsc_wc_path != NULL)
+ {
+ wc_path = vim_strsave(search_ctx->ffsc_wc_path);
+ temp = alloc(STRLEN(search_ctx->ffsc_wc_path)
+ + (STRLEN(search_ctx->ffsc_fix_path) - len));
+ }
+
+ if (temp == NULL || wc_path == NULL)
+ {
+ vim_free(buf);
+ vim_free(temp);
+ vim_free(wc_path);
+ goto error_return;
+ }
+
+ STRCPY(temp, search_ctx->ffsc_fix_path + len);
+ STRCAT(temp, search_ctx->ffsc_wc_path);
+ vim_free(search_ctx->ffsc_wc_path);
+ vim_free(wc_path);
+ search_ctx->ffsc_wc_path = temp;
+ }
+#endif
+ vim_free(buf);
+ }
sptr = ff_create_stack_element(ff_expand_buffer,
#ifdef FEAT_PATH_EXTRA