Skip to content

Commit b0967d5

Browse files
committed
patch 7.4.1116
Problem: delete(x, 'rf') does not delete files starting with a dot. Solution: Also delete files starting with a dot.
1 parent d023291 commit b0967d5

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7313,7 +7313,7 @@ delete_recursive(char_u *name)
73137313
if (exp == NULL)
73147314
return -1;
73157315
if (gen_expand_wildcards(1, &exp, &file_count, &files,
7316-
EW_DIR|EW_FILE|EW_SILENT) == OK)
7316+
EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT) == OK)
73177317
{
73187318
for (i = 0; i < file_count; ++i)
73197319
if (delete_recursive(files[i]) != 0)

src/misc1.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10013,7 +10013,7 @@ dos_expandpath(
1001310013
if (p[0] == '*' && p[1] == '*')
1001410014
starstar = TRUE;
1001510015

10016-
starts_with_dot = (*s == '.');
10016+
starts_with_dot = *s == '.' || (flags & EW_DODOT);
1001710017
pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
1001810018
if (pat == NULL)
1001910019
{
@@ -10096,7 +10096,8 @@ dos_expandpath(
1009610096
#endif
1009710097
/* Ignore entries starting with a dot, unless when asked for. Accept
1009810098
* all entries found with "matchname". */
10099-
if ((p[0] != '.' || starts_with_dot)
10099+
if ((p[0] != '.' || (starts_with_dot
10100+
&& p[1] != NUL && (p[1] != '.' || p[2] != NUL)))
1010010101
&& (matchname == NULL
1010110102
|| (regmatch.regprog != NULL
1010210103
&& vim_regexec(&regmatch, p, (colnr_T)0))
@@ -10325,7 +10326,7 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
1032510326
starstar = TRUE;
1032610327

1032710328
/* convert the file pattern to a regexp pattern */
10328-
starts_with_dot = (*s == '.');
10329+
starts_with_dot = *s == '.' || (flags & EW_DODOT);
1032910330
pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
1033010331
if (pat == NULL)
1033110332
{
@@ -10374,7 +10375,9 @@ unix_expandpath(gap, path, wildoff, flags, didstar)
1037410375
dp = readdir(dirp);
1037510376
if (dp == NULL)
1037610377
break;
10377-
if ((dp->d_name[0] != '.' || starts_with_dot)
10378+
if ((dp->d_name[0] != '.' || (starts_with_dot
10379+
&& dp->d_name[1] != NUL
10380+
&& (dp->d_name[1] != '.' || dp->d_name[2] != NUL)))
1037810381
&& ((regmatch.regprog != NULL && vim_regexec(&regmatch,
1037910382
(char_u *)dp->d_name, (colnr_T)0))
1038010383
|| ((flags & EW_NOTWILD)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,8 @@ static char *(features[]) =
741741

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
1116,
744746
/**/
745747
1115,
746748
/**/

src/vim.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname);
835835
#define EW_ALLLINKS 0x1000 /* also links not pointing to existing file */
836836
#define EW_SHELLCMD 0x2000 /* called from expand_shellcmd(), don't check
837837
* if executable is in $PATH */
838+
#define EW_DODOT 0x4000 /* also files starting with a dot */
838839

839840
/* Flags for find_file_*() functions. */
840841
#define FINDFILE_FILE 0 /* only files */

0 commit comments

Comments
 (0)