Fix #332: Create missing directories if necessary
This commit is contained in:
parent
105093a070
commit
953d1570e6
@ -170,6 +170,9 @@ function! vimtex#latexmk#compile() " {{{1
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Initialize build dir
|
||||||
|
call s:latexmk_init_build_dir()
|
||||||
|
|
||||||
" Build command line and start latexmk
|
" Build command line and start latexmk
|
||||||
let exe = s:latexmk_build_cmd()
|
let exe = s:latexmk_build_cmd()
|
||||||
if !g:vimtex_latexmk_continuous && !g:vimtex_latexmk_background
|
if !g:vimtex_latexmk_continuous && !g:vimtex_latexmk_background
|
||||||
@ -196,6 +199,9 @@ function! vimtex#latexmk#compile_ss(verbose) " {{{1
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Initialize build dir
|
||||||
|
call s:latexmk_init_build_dir()
|
||||||
|
|
||||||
let l:vimtex_latexmk_continuous = g:vimtex_latexmk_continuous
|
let l:vimtex_latexmk_continuous = g:vimtex_latexmk_continuous
|
||||||
let g:vimtex_latexmk_continuous = 0
|
let g:vimtex_latexmk_continuous = 0
|
||||||
let exe = s:latexmk_build_cmd()
|
let exe = s:latexmk_build_cmd()
|
||||||
@ -489,6 +495,24 @@ function! s:latexmk_init_pid() " {{{1
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:latexmk_init_build_dir() " {{{1
|
||||||
|
if g:vimtex_latexmk_build_dir ==# '' | return | endif
|
||||||
|
|
||||||
|
" First create list of necessary directories
|
||||||
|
let l:dirs = split(glob(b:vimtex.root . '/**/*.tex'), '\n')
|
||||||
|
call map(l:dirs, 'fnamemodify(v:val, '':h'')')
|
||||||
|
call map(l:dirs, 'strpart(v:val, strlen(b:vimtex.root) + 1)')
|
||||||
|
call uniq(sort(filter(l:dirs, "v:val !=# ''")))
|
||||||
|
call map(l:dirs,
|
||||||
|
\ "b:vimtex.root . '/' . g:vimtex_latexmk_build_dir . '/' . v:val")
|
||||||
|
call filter(l:dirs, '!isdirectory(v:val)')
|
||||||
|
|
||||||
|
" Create the non-existing directories
|
||||||
|
for l:dir in l:dirs
|
||||||
|
call mkdir(l:dir, 'p')
|
||||||
|
endfor
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:latexmk_set_pid() " {{{1
|
function! s:latexmk_set_pid() " {{{1
|
||||||
if has('win32')
|
if has('win32')
|
||||||
let pidcmd = 'tasklist /fi "imagename eq latexmk.exe"'
|
let pidcmd = 'tasklist /fi "imagename eq latexmk.exe"'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user