Mercurial > vim
comparison src/ex_cmds2.c @ 13724:5ef1e6170589 v8.0.1734
patch 8.0.1734: package directory not added to 'rtp' if prefix matches
commit https://github.com/vim/vim/commit/f98a39ca57d001ba3e24831bae1e375790fb41f0
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Apr 18 22:18:23 2018 +0200
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 https://github.com/vim/vim/issues/2817)
Also handle different ways of spelling a path.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 18 Apr 2018 22:30:07 +0200 |
parents | 04019fc3de93 |
children | 8ca1da2a043b |
comparison
equal
deleted
inserted
replaced
13723:81a4e59f7f83 | 13724:5ef1e6170589 |
---|---|
3819 static int APP_BOTH; | 3819 static int APP_BOTH; |
3820 | 3820 |
3821 static void | 3821 static void |
3822 add_pack_plugin(char_u *fname, void *cookie) | 3822 add_pack_plugin(char_u *fname, void *cookie) |
3823 { | 3823 { |
3824 if (cookie != &APP_LOAD && strstr((char *)p_rtp, (char *)fname) == NULL) | 3824 if (cookie != &APP_LOAD) |
3825 /* directory is not yet in 'runtimepath', add it */ | 3825 { |
3826 if (add_pack_dir_to_rtp(fname) == FAIL) | 3826 char_u *buf = alloc(MAXPATHL); |
3827 char_u *p; | |
3828 int found = FALSE; | |
3829 | |
3830 if (buf == NULL) | |
3827 return; | 3831 return; |
3832 p = p_rtp; | |
3833 while (*p != NUL) | |
3834 { | |
3835 copy_option_part(&p, buf, MAXPATHL, ","); | |
3836 if (pathcmp((char *)buf, (char *)fname, -1) == 0) | |
3837 { | |
3838 found = TRUE; | |
3839 break; | |
3840 } | |
3841 } | |
3842 vim_free(buf); | |
3843 if (!found) | |
3844 /* directory is not yet in 'runtimepath', add it */ | |
3845 if (add_pack_dir_to_rtp(fname) == FAIL) | |
3846 return; | |
3847 } | |
3828 | 3848 |
3829 if (cookie != &APP_ADD_DIR) | 3849 if (cookie != &APP_ADD_DIR) |
3830 load_pack_plugin(fname); | 3850 load_pack_plugin(fname); |
3831 } | 3851 } |
3832 | 3852 |