summaryrefslogtreecommitdiff
path: root/src/ex_cmds2.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-07-01 15:39:40 +0200
committerBram Moolenaar <Bram@vim.org>2016-07-01 15:39:40 +0200
commit4c5717ed8a81f5ae9dfe4f38b17a61fc8421054b (patch)
treef3ddf7e9696b5479a4b785ba44f1215db211c2c0 /src/ex_cmds2.c
parent40de45664c20e7ca46a28a3f472202f90e47f8bf (diff)
downloadvim-4c5717ed8a81f5ae9dfe4f38b17a61fc8421054b.zip
patch 7.4.1973
Problem: On MS-Windows the package directory may be added at the end because of forward/backward slash differences. (Matthew Desjardins) Solution: Ignore slash differences.
Diffstat (limited to 'src/ex_cmds2.c')
-rw-r--r--src/ex_cmds2.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index e6ef38114..e255a13d7 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -3349,6 +3349,7 @@ add_pack_plugin(char_u *fname, void *cookie)
char_u *afterdir;
size_t afterlen = 0;
char_u *ffname = fix_fname(fname);
+ int fname_len;
if (ffname == NULL)
return;
@@ -3369,7 +3370,20 @@ add_pack_plugin(char_u *fname, void *cookie)
* find the part up to "pack" in 'runtimepath' */
c = *p4;
*p4 = NUL;
- insp = (char_u *)strstr((char *)p_rtp, (char *)ffname);
+
+ /* Find "ffname" in "p_rtp", ignoring '/' vs '\' differences. */
+ fname_len = STRLEN(ffname);
+ insp = p_rtp;
+ for (;;)
+ {
+ if (vim_fnamencmp(insp, ffname, fname_len) == 0)
+ break;
+ insp = vim_strchr(insp, ',');
+ if (insp == NULL)
+ break;
+ ++insp;
+ }
+
if (insp == NULL)
/* not found, append at the end */
insp = p_rtp + STRLEN(p_rtp);