From b1020447d330c05520cd1cfb71f2fa1838e35289 Mon Sep 17 00:00:00 2001 From: micbou Date: Sat, 4 Jul 2015 13:31:23 +0200 Subject: [PATCH] Escape backslashes in path Backslashes in path must be escaped before being processed by the substitute() function. --- autoload/vimtex/util.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/vimtex/util.vim b/autoload/vimtex/util.vim index 3dde1e5..2c9bcf7 100644 --- a/autoload/vimtex/util.vim +++ b/autoload/vimtex/util.vim @@ -121,14 +121,18 @@ endfunction " }}}1 function! vimtex#util#fnameescape(path) " {{{1 + " Blackslashes in path must be escaped to be correctly parsed by the + " substitute() function. + let l:path = escape(a:path, '\') + " " In a Windows environment, a path used in "cmd" only needs to be enclosed by - " double quotes. shellscape() on Windows with "shellslash" set will produce + " double quotes. shellescape() on Windows with "shellslash" set will produce " a path enclosed by single quotes, which "cmd" does not recognize and " reports an error. Any path that goes into vimtex#util#execute() should be " processed through this function. " - return has('win32') ? '"' . a:path . '"' : shellescape(a:path) + return has('win32') ? '"' . l:path . '"' : shellescape(l:path) endfunction " }}}1