summaryrefslogtreecommitdiffstats
path: root/autoload/rust.vim
diff options
context:
space:
mode:
Diffstat (limited to 'autoload/rust.vim')
-rw-r--r--autoload/rust.vim13
1 files changed, 11 insertions, 2 deletions
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.