From 199846c6d87c9ea60eb5f9f8f68e2d9ea4f02b2a Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 16 Oct 2019 14:56:00 +0200 Subject: Update --- autoload/rust.vim | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'autoload/rust.vim') diff --git a/autoload/rust.vim b/autoload/rust.vim index e8a675f3..b6ab1c68 100644 --- a/autoload/rust.vim +++ b/autoload/rust.vim @@ -398,10 +398,19 @@ function! s:RmDir(path) echoerr 'Attempted to delete empty path' return 0 elseif a:path ==# '/' || a:path ==# $HOME - echoerr 'Attempted to delete protected path: ' . a:path + let l:path = expand(a:path) + if l:path ==# '/' || l:path ==# $HOME + echoerr 'Attempted to delete protected path: ' . a:path + return 0 + endif + endif + + if !isdirectory(a:path) return 0 endif - return system("rm -rf " . shellescape(a:path)) + + " delete() returns 0 when removing file successfully + return delete(a:path, 'rf') == 0 endfunction " Executes {cmd} with the cwd set to {pwd}, without changing Vim's cwd. -- cgit v1.2.3