parent
140d32fcdd
commit
b37db4e109
@ -14,7 +14,12 @@ let g:loaded_vimwiki_auto = 1
|
|||||||
function! s:normalize_path(path) "{{{
|
function! s:normalize_path(path) "{{{
|
||||||
let g:VimwikiLog.normalize_path += 1 "XXX
|
let g:VimwikiLog.normalize_path += 1 "XXX
|
||||||
" resolve doesn't work quite right with symlinks ended with / or \
|
" resolve doesn't work quite right with symlinks ended with / or \
|
||||||
return resolve(expand(substitute(a:path, '[/\\]\+$', '', ''))).'/'
|
let path = substitute(a:path, '[/\\]\+$', '', '')
|
||||||
|
if path !~# '^scp:'
|
||||||
|
return resolve(expand(path)).'/'
|
||||||
|
else
|
||||||
|
return path.'/'
|
||||||
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
" s:path_html
|
" s:path_html
|
||||||
@ -239,6 +244,7 @@ endfunction "}}}
|
|||||||
" vimwiki#base#mkdir will ask before creating a directory
|
" vimwiki#base#mkdir will ask before creating a directory
|
||||||
function! vimwiki#base#mkdir(path, ...) "{{{
|
function! vimwiki#base#mkdir(path, ...) "{{{
|
||||||
let path = expand(a:path)
|
let path = expand(a:path)
|
||||||
|
if path !~# '^scp:'
|
||||||
if !isdirectory(path) && exists("*mkdir")
|
if !isdirectory(path) && exists("*mkdir")
|
||||||
let path = vimwiki#u#chomp_slash(path)
|
let path = vimwiki#u#chomp_slash(path)
|
||||||
if vimwiki#u#is_windows() && !empty(g:vimwiki_w32_dir_enc)
|
if vimwiki#u#is_windows() && !empty(g:vimwiki_w32_dir_enc)
|
||||||
@ -250,6 +256,9 @@ function! vimwiki#base#mkdir(path, ...) "{{{
|
|||||||
call mkdir(path, "p")
|
call mkdir(path, "p")
|
||||||
endif
|
endif
|
||||||
return 1
|
return 1
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
endfunction " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
" vimwiki#base#file_pattern
|
" vimwiki#base#file_pattern
|
||||||
@ -286,7 +295,11 @@ function! vimwiki#base#subdir(path, filename)"{{{
|
|||||||
let path = a:path
|
let path = a:path
|
||||||
" ensure that we are not fooled by a symbolic link
|
" ensure that we are not fooled by a symbolic link
|
||||||
"FIXME if we are not "fooled", we end up in a completely different wiki?
|
"FIXME if we are not "fooled", we end up in a completely different wiki?
|
||||||
|
if a:filename !~# '^scp:'
|
||||||
let filename = resolve(a:filename)
|
let filename = resolve(a:filename)
|
||||||
|
else
|
||||||
|
let filename = a:filename
|
||||||
|
endif
|
||||||
let idx = 0
|
let idx = 0
|
||||||
"FIXME this can terminate in the middle of a path component!
|
"FIXME this can terminate in the middle of a path component!
|
||||||
while path[idx] ==? filename[idx]
|
while path[idx] ==? filename[idx]
|
||||||
|
@ -36,11 +36,15 @@ endfunction "}}}
|
|||||||
|
|
||||||
function! vimwiki#u#path_norm(path) "{{{
|
function! vimwiki#u#path_norm(path) "{{{
|
||||||
" /-slashes
|
" /-slashes
|
||||||
|
if path !~# '^scp:'
|
||||||
let path = substitute(a:path, '\', '/', 'g')
|
let path = substitute(a:path, '\', '/', 'g')
|
||||||
" treat multiple consecutive slashes as one path separator
|
" treat multiple consecutive slashes as one path separator
|
||||||
let path = substitute(path, '/\+', '/', 'g')
|
let path = substitute(path, '/\+', '/', 'g')
|
||||||
" ensure that we are not fooled by a symbolic link
|
" ensure that we are not fooled by a symbolic link
|
||||||
return resolve(path)
|
return resolve(path)
|
||||||
|
else
|
||||||
|
return a:path
|
||||||
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
|
||||||
function! vimwiki#u#is_link_to_dir(link) "{{{
|
function! vimwiki#u#is_link_to_dir(link) "{{{
|
||||||
|
Loading…
Reference in New Issue
Block a user