comparison autoload/gutentags.vim @ 164:28d4dae03f2a

If a user init function specified an absolute path, don't mess with it.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 18 Feb 2017 18:20:51 -0800
parents 6b00f4383708
children 1fe62e7f1fae
comparison
equal deleted inserted replaced
163:0f6605a9398b 164:28d4dae03f2a
53 53
54 " Gets a file path in the resource folder. 54 " Gets a file path in the resource folder.
55 function! gutentags#get_res_file(filename) abort 55 function! gutentags#get_res_file(filename) abort
56 return g:gutentags_res_dir . a:filename 56 return g:gutentags_res_dir . a:filename
57 endfunction 57 endfunction
58
59 " Returns whether a path is rooted.
60 if has('win32') || has('win64')
61 function! gutentags#is_path_rooted(path) abort
62 return len(a:path) >= 2 && a:path[1] == ':'
63 endfunction
64 else
65 function! gutentags#is_path_rooted(path) abort
66 return !empty(a:path) && a:path[0] == '/'
67 endfunction
68 endif
58 69
59 " }}} 70 " }}}
60 71
61 " Gutentags Setup {{{ 72 " Gutentags Setup {{{
62 73
160 return get(s:known_projects, a:path, {}) 171 return get(s:known_projects, a:path, {})
161 endfunction 172 endfunction
162 173
163 " Generate a path for a given filename in the cache directory. 174 " Generate a path for a given filename in the cache directory.
164 function! gutentags#get_cachefile(root_dir, filename) abort 175 function! gutentags#get_cachefile(root_dir, filename) abort
176 if gutentags#is_path_rooted(a:filename)
177 return a:filename
178 endif
165 let l:tag_path = gutentags#stripslash(a:root_dir) . '/' . a:filename 179 let l:tag_path = gutentags#stripslash(a:root_dir) . '/' . a:filename
166 if g:gutentags_cache_dir != "" 180 if g:gutentags_cache_dir != ""
167 " Put the tag file in the cache dir instead of inside the 181 " Put the tag file in the cache dir instead of inside the
168 " project root. 182 " project root.
169 let l:tag_path = g:gutentags_cache_dir . '/' . 183 let l:tag_path = g:gutentags_cache_dir . '/' .