summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-18 22:18:23 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-18 22:18:23 +0200
commitf98a39ca57d001ba3e24831bae1e375790fb41f0 (patch)
treefded5ab3d82a0600c94cfbd3cdab9c9475acbdeb /src/ex_cmds2.c
parentbad0ce7b26be5eed8524347018f4c835b212f8d1 (diff)
patch 8.0.1734: package directory not added to 'rtp' if prefix matchesv8.0.1734
Problem: Package directory not added to 'rtp' if prefix matches. Solution: Check the match is a full match. (Ozaki Kiichi, closes #2817) Also handle different ways of spelling a path.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 83f09661cc..3946627416 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -3821,10 +3821,30 @@ static int APP_BOTH;
static void
add_pack_plugin(char_u *fname, void *cookie)
{
- if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)fname) == NULL)
- /* directory is not yet in 'runtimepath', add it */
- if (add_pack_dir_to_rtp(fname) == FAIL)
+ if (cookie != &APP_LOAD)
+ {
+ char_u *buf = alloc(MAXPATHL);
+ char_u *p;
+ int found = FALSE;
+
+ if (buf == NULL)
return;
+ p = p_rtp;
+ while (*p != NUL)
+ {
+ copy_option_part(&p, buf, MAXPATHL, ",");
+ if (pathcmp((char *)buf, (char *)fname, -1) == 0)
+ {
+ found = TRUE;
+ break;
+ }
+ }
+ vim_free(buf);
+ if (!found)
+ /* directory is not yet in 'runtimepath', add it */
+ if (add_pack_dir_to_rtp(fname) == FAIL)
+ return;
+ }
if (cookie != &APP_ADD_DIR)
load_pack_plugin(fname);