From d2ff96717e9f5bb3392c42df79df5f7e4d8c0822 Mon Sep 17 00:00:00 2001 From: Ivan Tishchenko Date: Thu, 29 Jan 2015 13:48:15 +0400 Subject: [PATCH] Encapsulate tag path into a function; expand paths in it to make them absolute --- autoload/vimwiki/base.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 2cb1c23..5541dbe 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -2077,10 +2077,16 @@ function! vimwiki#base#scan_tags(lines, page_name) "{{{ return metadata endfunction " }}} +" vimwiki#base#metadata_file_path +" Returns tags metadata file path +function! vimwiki#base#metadata_file_path() abort "{{{ + return fnamemodify(VimwikiGet('path') . '/' . s:TAGS_METADATA_FILE_NAME, ':p') +endfunction " }}} + " vimwiki#base#load_tags_metadata " Loads tags metadata from file, returns a dictionary function! vimwiki#base#load_tags_metadata() abort "{{{ - let metadata_path = VimwikiGet('path') . '/' . s:TAGS_METADATA_FILE_NAME + let metadata_path = vimwiki#base#metadata_file_path() if !filereadable(metadata_path) return [] endif @@ -2142,7 +2148,7 @@ endfunction " }}} " vimwiki#base#write_tags_metadata " Saves metadata object into a file. Throws exceptions in case of problems. function! vimwiki#base#write_tags_metadata(metadata) "{{{ - let metadata_path = VimwikiGet('path') . '/' . s:TAGS_METADATA_FILE_NAME + let metadata_path = vimwiki#base#metadata_file_path() let entries = [] for entry in a:metadata let entry_data = entry.pagename . "\t" . entry.link