mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 23:38:17 +00:00
vim-patch:7.4.1116
Problem: delete(x, 'rf') does not delete files starting with a dot.
Solution: Also delete files starting with a dot.
b0967d587f
This commit is contained in:
@@ -604,8 +604,8 @@ static size_t do_path_expand(garray_T *gap, const char_u *path,
|
|||||||
starstar = true;
|
starstar = true;
|
||||||
|
|
||||||
// convert the file pattern to a regexp pattern
|
// convert the file pattern to a regexp pattern
|
||||||
int starts_with_dot = (*s == '.');
|
int starts_with_dot = *s == '.' || (flags & EW_DODOT);
|
||||||
char_u *pat = file_pat_to_reg_pat(s, e, NULL, false);
|
char_u *pat = file_pat_to_reg_pat(s, e, NULL, FALSE);
|
||||||
if (pat == NULL) {
|
if (pat == NULL) {
|
||||||
xfree(buf);
|
xfree(buf);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -649,7 +649,9 @@ static size_t do_path_expand(garray_T *gap, const char_u *path,
|
|||||||
char_u *name;
|
char_u *name;
|
||||||
scandir_next_with_dots(NULL /* initialize */);
|
scandir_next_with_dots(NULL /* initialize */);
|
||||||
while((name = (char_u *) scandir_next_with_dots(&dir)) && name != NULL) {
|
while((name = (char_u *) scandir_next_with_dots(&dir)) && name != NULL) {
|
||||||
if ((name[0] != '.' || starts_with_dot)
|
if ((name[0] != '.' || (starts_with_dot
|
||||||
|
&& name[1] != NUL
|
||||||
|
&& (name[1] != '.' || name[2] != NUL)))
|
||||||
&& ((regmatch.regprog != NULL && vim_regexec(®match, name, 0))
|
&& ((regmatch.regprog != NULL && vim_regexec(®match, name, 0))
|
||||||
|| ((flags & EW_NOTWILD)
|
|| ((flags & EW_NOTWILD)
|
||||||
&& fnamencmp(path + (s - buf), name, e - s) == 0))) {
|
&& fnamencmp(path + (s - buf), name, e - s) == 0))) {
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
|
/* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
|
||||||
* is used when executing commands and EW_SILENT for interactive expanding. */
|
* is used when executing commands and EW_SILENT for interactive expanding. */
|
||||||
#define EW_ALLLINKS 0x1000 // also links not pointing to existing file
|
#define EW_ALLLINKS 0x1000 // also links not pointing to existing file
|
||||||
|
#define EW_DODOT 0x4000 // also files starting with a dot
|
||||||
|
|
||||||
/// Return value for the comparison of two files. Also @see path_full_compare.
|
/// Return value for the comparison of two files. Also @see path_full_compare.
|
||||||
typedef enum file_comparison {
|
typedef enum file_comparison {
|
||||||
|
@@ -70,7 +70,8 @@ int delete_recursive(char_u *name)
|
|||||||
int file_count;
|
int file_count;
|
||||||
char_u *exp = vim_strsave(NameBuff);
|
char_u *exp = vim_strsave(NameBuff);
|
||||||
if (gen_expand_wildcards(1, &exp, &file_count, &files,
|
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 (int i = 0; i < file_count; i++) {
|
for (int i = 0; i < file_count; i++) {
|
||||||
if (delete_recursive(files[i]) != 0) {
|
if (delete_recursive(files[i]) != 0) {
|
||||||
result = -1;
|
result = -1;
|
||||||
|
@@ -248,7 +248,7 @@ static int included_patches[] = {
|
|||||||
// 1119,
|
// 1119,
|
||||||
// 1118,
|
// 1118,
|
||||||
// 1117,
|
// 1117,
|
||||||
// 1116,
|
1116,
|
||||||
// 1115 NA
|
// 1115 NA
|
||||||
1114,
|
1114,
|
||||||
1113,
|
1113,
|
||||||
|
Reference in New Issue
Block a user