diff options
author | James McCoy <jamessan@jamessan.com> | 2018-12-29 01:15:59 -0500 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2018-12-29 12:57:16 -0500 |
commit | 91f40ff2841c4f3af524010145ee54d6d048ce07 (patch) | |
tree | d61ea59a69b63103179f41a2a796cc8518a5603f /src | |
parent | e09fb6ee534bf02535e4458cb6eb24aefb3aab24 (diff) | |
download | rneovim-91f40ff2841c4f3af524010145ee54d6d048ce07.tar.gz rneovim-91f40ff2841c4f3af524010145ee54d6d048ce07.tar.bz2 rneovim-91f40ff2841c4f3af524010145ee54d6d048ce07.zip |
vim-patch:8.0.1734: package directory not added to 'rtp' if prefix matches
Problem: Package directory not added to 'rtp' if prefix matches.
Solution: Check the match is a full match. (Ozaki Kiichi, closes vim/vim#2817)
Also handle different ways of spelling a path.
https://github.com/vim/vim/commit/f98a39ca57d001ba3e24831bae1e375790fb41f0
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds2.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 4e3fc86539..f46e4108f4 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2683,10 +2683,24 @@ 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) { - return; + if (cookie != &APP_LOAD) { + char *buf = xmalloc(MAXPATHL); + bool found = false; + + const char *p = (const char *)p_rtp; + while (*p != NUL) { + copy_option_part((char_u **)&p, (char_u *)buf, MAXPATHL, ","); + if (path_fnamecmp(buf, (char *)fname) == 0) { + found = true; + break; + } + } + xfree(buf); + if (!found) { + // directory is not yet in 'runtimepath', add it + if (add_pack_dir_to_rtp(fname) == FAIL) { + return; + } } } |