Patch 7.4.1120
Problem: delete(x, 'rf') fails if a directory is empty. (Lcd)
Solution: Ignore not finding matches in an empty directory.
Files: src/fileio.c, src/misc1.c, src/vim.h, src/testdir/test_delete.vim
*** ../vim-7.4.1119/src/fileio.c 2016-01-17 16:49:38.636505419 +0100
--- src/fileio.c 2016-01-17 18:17:08.028275767 +0100
***************
*** 7313,7319 ****
if (exp == NULL)
return -1;
if (gen_expand_wildcards(1, &exp, &file_count, &files,
! EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT) == OK)
{
for (i = 0; i < file_count; ++i)
if (delete_recursive(files[i]) != 0)
--- 7313,7319 ----
if (exp == NULL)
return -1;
if (gen_expand_wildcards(1, &exp, &file_count, &files,
! EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT|EW_EMPTYOK) == OK)
{
for (i = 0; i < file_count; ++i)
if (delete_recursive(files[i]) != 0)
*** ../vim-7.4.1119/src/misc1.c 2016-01-17 17:04:01.091290646 +0100
--- src/misc1.c 2016-01-17 18:16:55.824407289 +0100
***************
*** 11087,11093 ****
recursive = FALSE;
! return (ga.ga_data != NULL) ? retval : FAIL;
}
# ifdef VIM_BACKTICK
--- 11087,11093 ----
recursive = FALSE;
! return ((flags & EW_EMPTYOK) || ga.ga_data != NULL) ? retval : FAIL;
}
# ifdef VIM_BACKTICK
*** ../vim-7.4.1119/src/vim.h 2016-01-17 16:49:38.640505376 +0100
--- src/vim.h 2016-01-17 18:15:49.209125263 +0100
***************
*** 836,841 ****
--- 836,842 ----
#define EW_SHELLCMD 0x2000 /* called from expand_shellcmd(), don't check
* if executable is in $PATH */
#define EW_DODOT 0x4000 /* also files starting with a dot */
+ #define EW_EMPTYOK 0x8000 /* no matches is not an error */
/* Flags for find_file_*() functions. */
#define FINDFILE_FILE 0 /* only files */
*** ../vim-7.4.1119/src/testdir/test_delete.vim 2016-01-17 15:56:29.366605222
+0100
--- src/testdir/test_delete.vim 2016-01-17 18:11:30.479914696 +0100
***************
*** 21,26 ****
--- 21,27 ----
func Test_recursive_delete()
call mkdir('Xdir1')
call mkdir('Xdir1/subdir')
+ call mkdir('Xdir1/empty')
split Xdir1/Xfile
call setline(1, ['a', 'b'])
w
***************
*** 30,35 ****
--- 31,37 ----
call assert_equal(['a', 'b'], readfile('Xdir1/Xfile'))
call assert_true(isdirectory('Xdir1/subdir'))
call assert_equal(['a', 'b'], readfile('Xdir1/subdir/Xfile'))
+ call assert_true(isdirectory('Xdir1/empty'))
call assert_equal(0, delete('Xdir1', 'rf'))
call assert_false(isdirectory('Xdir1'))
call assert_equal(-1, delete('Xdir1', 'd'))
*** ../vim-7.4.1119/src/version.c 2016-01-17 18:04:15.412608602 +0100
--- src/version.c 2016-01-17 18:10:16.176716045 +0100
***************
*** 743,744 ****
--- 743,746 ----
{ /* Add new patch number below this line */
+ /**/
+ 1120,
/**/
--
The budget process was invented by an alien race of sadistic beings who
resemble large cats.
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.