if (exp == NULL)
return -1;
if (gen_expand_wildcards(1, &exp, &file_count, &files,
- EW_DIR|EW_FILE|EW_SILENT) == OK)
+ EW_DIR|EW_FILE|EW_SILENT|EW_ALLLINKS|EW_DODOT) == OK)
{
for (i = 0; i < file_count; ++i)
if (delete_recursive(files[i]) != 0)
if (p[0] == '*' && p[1] == '*')
starstar = TRUE;
- starts_with_dot = (*s == '.');
+ starts_with_dot = *s == '.' || (flags & EW_DODOT);
pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
if (pat == NULL)
{
#endif
/* Ignore entries starting with a dot, unless when asked for. Accept
* all entries found with "matchname". */
- if ((p[0] != '.' || starts_with_dot)
+ if ((p[0] != '.' || (starts_with_dot
+ && p[1] != NUL && (p[1] != '.' || p[2] != NUL)))
&& (matchname == NULL
|| (regmatch.regprog != NULL
&& vim_regexec(®match, p, (colnr_T)0))
starstar = TRUE;
/* convert the file pattern to a regexp pattern */
- starts_with_dot = (*s == '.');
+ starts_with_dot = *s == '.' || (flags & EW_DODOT);
pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
if (pat == NULL)
{
dp = readdir(dirp);
if (dp == NULL)
break;
- if ((dp->d_name[0] != '.' || starts_with_dot)
+ if ((dp->d_name[0] != '.' || (starts_with_dot
+ && dp->d_name[1] != NUL
+ && (dp->d_name[1] != '.' || dp->d_name[2] != NUL)))
&& ((regmatch.regprog != NULL && vim_regexec(®match,
(char_u *)dp->d_name, (colnr_T)0))
|| ((flags & EW_NOTWILD)
#define EW_ALLLINKS 0x1000 /* also links not pointing to existing file */
#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 */
/* Flags for find_file_*() functions. */
#define FINDFILE_FILE 0 /* only files */