Mercurial > vim
comparison src/misc1.c @ 7633:2a280b8e7040 v7.4.1116
commit https://github.com/vim/vim/commit/b0967d587fc420fa02832533d4915c85d1a78c17
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 17 16:49:43 2016 +0100
patch 7.4.1116
Problem: delete(x, 'rf') does not delete files starting with a dot.
Solution: Also delete files starting with a dot.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 17 Jan 2016 17:00:04 +0100 |
parents | e0acbccdf1fc |
children | 1506f86b120f |
comparison
equal
deleted
inserted
replaced
7632:8884404a90a9 | 7633:2a280b8e7040 |
---|---|
10011 /* Check for "**" between "s" and "e". */ | 10011 /* Check for "**" between "s" and "e". */ |
10012 for (p = s; p < e; ++p) | 10012 for (p = s; p < e; ++p) |
10013 if (p[0] == '*' && p[1] == '*') | 10013 if (p[0] == '*' && p[1] == '*') |
10014 starstar = TRUE; | 10014 starstar = TRUE; |
10015 | 10015 |
10016 starts_with_dot = (*s == '.'); | 10016 starts_with_dot = *s == '.' || (flags & EW_DODOT); |
10017 pat = file_pat_to_reg_pat(s, e, NULL, FALSE); | 10017 pat = file_pat_to_reg_pat(s, e, NULL, FALSE); |
10018 if (pat == NULL) | 10018 if (pat == NULL) |
10019 { | 10019 { |
10020 vim_free(buf); | 10020 vim_free(buf); |
10021 return 0; | 10021 return 0; |
10094 #else | 10094 #else |
10095 p = (char_u *)fb.ff_name; | 10095 p = (char_u *)fb.ff_name; |
10096 #endif | 10096 #endif |
10097 /* Ignore entries starting with a dot, unless when asked for. Accept | 10097 /* Ignore entries starting with a dot, unless when asked for. Accept |
10098 * all entries found with "matchname". */ | 10098 * 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))) | |
10100 && (matchname == NULL | 10101 && (matchname == NULL |
10101 || (regmatch.regprog != NULL | 10102 || (regmatch.regprog != NULL |
10102 && vim_regexec(®match, p, (colnr_T)0)) | 10103 && vim_regexec(®match, p, (colnr_T)0)) |
10103 || ((flags & EW_NOTWILD) | 10104 || ((flags & EW_NOTWILD) |
10104 && fnamencmp(path + (s - buf), p, e - s) == 0))) | 10105 && fnamencmp(path + (s - buf), p, e - s) == 0))) |
10323 for (p = s; p < e; ++p) | 10324 for (p = s; p < e; ++p) |
10324 if (p[0] == '*' && p[1] == '*') | 10325 if (p[0] == '*' && p[1] == '*') |
10325 starstar = TRUE; | 10326 starstar = TRUE; |
10326 | 10327 |
10327 /* convert the file pattern to a regexp pattern */ | 10328 /* convert the file pattern to a regexp pattern */ |
10328 starts_with_dot = (*s == '.'); | 10329 starts_with_dot = *s == '.' || (flags & EW_DODOT); |
10329 pat = file_pat_to_reg_pat(s, e, NULL, FALSE); | 10330 pat = file_pat_to_reg_pat(s, e, NULL, FALSE); |
10330 if (pat == NULL) | 10331 if (pat == NULL) |
10331 { | 10332 { |
10332 vim_free(buf); | 10333 vim_free(buf); |
10333 return 0; | 10334 return 0; |
10372 for (;;) | 10373 for (;;) |
10373 { | 10374 { |
10374 dp = readdir(dirp); | 10375 dp = readdir(dirp); |
10375 if (dp == NULL) | 10376 if (dp == NULL) |
10376 break; | 10377 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))) | |
10378 && ((regmatch.regprog != NULL && vim_regexec(®match, | 10381 && ((regmatch.regprog != NULL && vim_regexec(®match, |
10379 (char_u *)dp->d_name, (colnr_T)0)) | 10382 (char_u *)dp->d_name, (colnr_T)0)) |
10380 || ((flags & EW_NOTWILD) | 10383 || ((flags & EW_NOTWILD) |
10381 && fnamencmp(path + (s - buf), dp->d_name, e - s) == 0))) | 10384 && fnamencmp(path + (s - buf), dp->d_name, e - s) == 0))) |
10382 { | 10385 { |