changeset 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 0f6605a9398b
children cbc1ebe23ef1
files autoload/gutentags.vim
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/autoload/gutentags.vim	Fri Feb 17 20:39:36 2017 -0800
+++ b/autoload/gutentags.vim	Sat Feb 18 18:20:51 2017 -0800
@@ -56,6 +56,17 @@
     return g:gutentags_res_dir . a:filename
 endfunction
 
+" Returns whether a path is rooted.
+if has('win32') || has('win64')
+function! gutentags#is_path_rooted(path) abort
+  return len(a:path) >= 2 && a:path[1] == ':'
+endfunction
+else
+function! gutentags#is_path_rooted(path) abort
+  return !empty(a:path) && a:path[0] == '/'
+endfunction
+endif
+
 " }}}
 
 " Gutentags Setup {{{
@@ -162,6 +173,9 @@
 
 " Generate a path for a given filename in the cache directory.
 function! gutentags#get_cachefile(root_dir, filename) abort
+    if gutentags#is_path_rooted(a:filename)
+        return a:filename
+    endif
     let l:tag_path = gutentags#stripslash(a:root_dir) . '/' . a:filename
     if g:gutentags_cache_dir != ""
         " Put the tag file in the cache dir instead of inside the