Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 38f46b6

Browse files
committed
A (hopefully) safer "rm -rf".
Also remove javac option g:syntastic_java_javac_temp_dir, as it's way to easy to make it trigger a disaster.
1 parent 5359f7f commit 38f46b6

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

autoload/syntastic/util.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ endfunction " }}}2
6161

6262
" Recursively remove a directory
6363
function! syntastic#util#rmrf(what) " {{{2
64-
if a:what == '.'
64+
" try to make sure we don't delete directories we didn't create
65+
if a:what !~? 'vim-syntastic-'
6566
return
6667
endif
6768

plugin/syntastic.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if has('reltime')
1919
lockvar! g:_SYNTASTIC_START
2020
endif
2121

22-
let g:_SYNTASTIC_VERSION = '3.5.0-146'
22+
let g:_SYNTASTIC_VERSION = '3.5.0-147'
2323
lockvar g:_SYNTASTIC_VERSION
2424

2525
" Sanity checks {{{1

syntax_checkers/java/javac.vim

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ if !exists('g:syntastic_java_javac_delete_output')
4747
let g:syntastic_java_javac_delete_output = 1
4848
endif
4949

50-
if !exists('g:syntastic_java_javac_temp_dir')
51-
let g:syntastic_java_javac_temp_dir = syntastic#util#tmpdir()
52-
endif
53-
5450
if !exists('g:syntastic_java_javac_autoload_maven_classpath')
5551
let g:syntastic_java_javac_autoload_maven_classpath = 1
5652
endif
@@ -93,7 +89,7 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
9389

9490
let output_dir = ''
9591
if g:syntastic_java_javac_delete_output
96-
let output_dir = g:syntastic_java_javac_temp_dir
92+
let output_dir = syntastic#util#tmpdir()
9793
let javac_opts .= ' -d ' . syntastic#util#shescape(output_dir)
9894
endif
9995

@@ -166,15 +162,15 @@ function! SyntaxCheckers_java_javac_GetLocList() dict " {{{1
166162
\ '%+C%.%#,'.
167163
\ '%-G%.%#'
168164

169-
if g:syntastic_java_javac_delete_output
165+
if output_dir != ''
170166
silent! call mkdir(output_dir, 'p')
171167
endif
172168
let errors = SyntasticMake({
173169
\ 'makeprg': makeprg,
174170
\ 'errorformat': errorformat,
175171
\ 'postprocess': ['cygwinRemoveCR'] })
176172

177-
if g:syntastic_java_javac_delete_output
173+
if output_dir != ''
178174
call syntastic#util#rmrf(output_dir)
179175
endif
180176
return errors

0 commit comments

Comments
 (0)