diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2019-10-16 14:56:00 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2019-10-16 14:56:00 +0200 |
commit | 199846c6d87c9ea60eb5f9f8f68e2d9ea4f02b2a (patch) | |
tree | 43a35af46ea780decdd9146601eef6af561cb14c /autoload/rust.vim | |
parent | f95026252c5a31242903a98c741887696dfbb11f (diff) | |
download | vim-polyglot-199846c6d87c9ea60eb5f9f8f68e2d9ea4f02b2a.tar.gz vim-polyglot-199846c6d87c9ea60eb5f9f8f68e2d9ea4f02b2a.zip |
Update
Diffstat (limited to 'autoload/rust.vim')
-rw-r--r-- | autoload/rust.vim | 13 |
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. |