File src/fileops.c changed (mode: 100644) (index 1086d4251..376347dd7) |
... |
... |
make_dirs(FileView *view, char **names, int count, int create_parent) |
3619 |
3619 |
status_bar_messagef("%d directorie%s created", n, (n == 1) ? "" : "s"); |
status_bar_messagef("%d directorie%s created", n, (n == 1) ? "" : "s"); |
3620 |
3620 |
} |
} |
3621 |
3621 |
|
|
3622 |
|
int |
|
|
3622 |
|
void |
3623 |
3623 |
make_files(FileView *view, char **names, int count) |
make_files(FileView *view, char **names, int count) |
3624 |
3624 |
{ |
{ |
3625 |
3625 |
int i; |
int i; |
|
3626 |
|
int n; |
3626 |
3627 |
char buf[COMMAND_GROUP_INFO_LEN + 1]; |
char buf[COMMAND_GROUP_INFO_LEN + 1]; |
3627 |
3628 |
size_t len; |
size_t len; |
3628 |
3629 |
|
|
|
... |
... |
make_files(FileView *view, char **names, int count) |
3632 |
3633 |
if(is_in_string_array(names, i, names[i])) |
if(is_in_string_array(names, i, names[i])) |
3633 |
3634 |
{ |
{ |
3634 |
3635 |
status_bar_errorf("Name \"%s\" duplicates", names[i]); |
status_bar_errorf("Name \"%s\" duplicates", names[i]); |
3635 |
|
return 1; |
|
|
3636 |
|
return; |
3636 |
3637 |
} |
} |
3637 |
3638 |
if(names[i][0] == '\0') |
if(names[i][0] == '\0') |
3638 |
3639 |
{ |
{ |
3639 |
3640 |
status_bar_errorf("Name #%d is empty", i + 1); |
status_bar_errorf("Name #%d is empty", i + 1); |
3640 |
|
return 1; |
|
|
3641 |
|
return; |
3641 |
3642 |
} |
} |
3642 |
3643 |
if(strchr(names[i], '/') != NULL) |
if(strchr(names[i], '/') != NULL) |
3643 |
3644 |
{ |
{ |
3644 |
3645 |
status_bar_errorf("Name \"%s\" contains slash", names[i]); |
status_bar_errorf("Name \"%s\" contains slash", names[i]); |
3645 |
|
return 1; |
|
|
3646 |
|
return; |
3646 |
3647 |
} |
} |
3647 |
3648 |
if(lstat(names[i], &st) == 0) |
if(lstat(names[i], &st) == 0) |
3648 |
3649 |
{ |
{ |
3649 |
3650 |
status_bar_errorf("File \"%s\" already exists", names[i]); |
status_bar_errorf("File \"%s\" already exists", names[i]); |
3650 |
|
return 1; |
|
|
3651 |
|
return; |
3651 |
3652 |
} |
} |
3652 |
3653 |
} |
} |
3653 |
3654 |
|
|
|
... |
... |
make_files(FileView *view, char **names, int count) |
3656 |
3657 |
|
|
3657 |
3658 |
get_group_file_list(names, count, buf); |
get_group_file_list(names, count, buf); |
3658 |
3659 |
cmd_group_begin(buf); |
cmd_group_begin(buf); |
|
3660 |
|
n = 0; |
3659 |
3661 |
for(i = 0; i < count; i++) |
for(i = 0; i < count; i++) |
3660 |
3662 |
{ |
{ |
3661 |
3663 |
char full[PATH_MAX]; |
char full[PATH_MAX]; |
3662 |
3664 |
snprintf(full, sizeof(full), "%s/%s", view->curr_dir, names[i]); |
snprintf(full, sizeof(full), "%s/%s", view->curr_dir, names[i]); |
3663 |
3665 |
if(perform_operation(OP_MKFILE, NULL, full, NULL) == 0) |
if(perform_operation(OP_MKFILE, NULL, full, NULL) == 0) |
|
3666 |
|
{ |
3664 |
3667 |
add_operation(OP_MKFILE, NULL, NULL, full, ""); |
add_operation(OP_MKFILE, NULL, NULL, full, ""); |
|
3668 |
|
n++; |
|
3669 |
|
} |
3665 |
3670 |
} |
} |
3666 |
3671 |
cmd_group_end(); |
cmd_group_end(); |
3667 |
3672 |
|
|
3668 |
|
go_to_first_file(view, names, count); |
|
|
3673 |
|
if(n > 0) |
|
3674 |
|
go_to_first_file(view, names, count); |
3669 |
3675 |
|
|
3670 |
|
return 0; |
|
|
3676 |
|
status_bar_messagef("%d file%s created", n, (n == 1) ? "" : "s"); |
3671 |
3677 |
} |
} |
3672 |
3678 |
|
|
3673 |
3679 |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ |
/* vim: set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab cinoptions-=(0 : */ |
File src/fileops.h changed (mode: 100644) (index 5ae3e2fac..fe14326eb) |
... |
... |
int cpmv_files(FileView *view, char **list, int nlines, int move, int type, |
68 |
68 |
int force); |
int force); |
69 |
69 |
int cpmv_files_bg(FileView *view, char **list, int nlines, int move, int force); |
int cpmv_files_bg(FileView *view, char **list, int nlines, int move, int force); |
70 |
70 |
void make_dirs(FileView *view, char **names, int count, int create_parent); |
void make_dirs(FileView *view, char **names, int count, int create_parent); |
71 |
|
int make_files(FileView *view, char **names, int count); |
|
|
71 |
|
void make_files(FileView *view, char **names, int count); |
72 |
72 |
|
|
73 |
73 |
#ifdef TEST |
#ifdef TEST |
74 |
74 |
const char * gen_clone_name(const char *normal_name); |
const char * gen_clone_name(const char *normal_name); |