parent
bb3026dba8
commit
ff90e980de
@ -148,3 +148,22 @@ function! vimwiki#path#is_absolute(path) "{{{
|
||||
return a:path =~# '\m^/\|\~/'
|
||||
endif
|
||||
endfunction "}}}
|
||||
|
||||
|
||||
" Combine a directory and a file into one path, doesn't generate duplicate
|
||||
" path separator in case the directory is also having an ending / or \. This
|
||||
" is because on windows ~\vimwiki//.tags is invalid but ~\vimwiki/.tags is a
|
||||
" valid path.
|
||||
if vimwiki#u#is_windows()
|
||||
function! vimwiki#path#join_path(directory, file)
|
||||
let directory = vimwiki#path#chomp_slash(a:directory)
|
||||
let file = substitute(a:file, '\m^[\\/]\+', '', '')
|
||||
return directory . '/' . file
|
||||
endfunction
|
||||
else
|
||||
function! vimwiki#path#join_path(directory, file)
|
||||
let directory = substitute(a:directory, '\m/\+$', '', '')
|
||||
let file = substitute(a:file, '\m^/\+', '', '')
|
||||
return directory . '/' . file
|
||||
endfunction
|
||||
endif
|
||||
|
@ -141,7 +141,7 @@ endfunction " }}}
|
||||
" vimwiki#tags#metadata_file_path
|
||||
" Returns tags metadata file path
|
||||
function! vimwiki#tags#metadata_file_path() abort "{{{
|
||||
return fnamemodify(VimwikiGet('path') . '/' . s:TAGS_METADATA_FILE_NAME, ':p')
|
||||
return fnamemodify(vimwiki#path#join_path(VimwikiGet('path'), s:TAGS_METADATA_FILE_NAME), ':p')
|
||||
endfunction " }}}
|
||||
|
||||
" s:load_tags_metadata
|
||||
|
Loading…
Reference in New Issue
Block a user