implementation of delete

This commit is contained in:
nova
2026-06-14 13:26:46 +02:00
parent 9bdf677a56
commit 50f7e7c67d
2 changed files with 30 additions and 2 deletions
+2
View File
@@ -20,6 +20,7 @@ static const char makefile_cmd[] = "touch"; /*as of now both only do ``rename_cm
static const char makedir_cmd[] = "mkdir";
static const char copy_cmd[] = "cp -r";
static const char cut_cmd[] = "mv";
static const char del_cmd[] = "rm -r";
static const mimetype mimetype_default_cmd[] = {
/* mimetype shell command
@@ -154,6 +155,7 @@ static const char ui_rename_text[];
static const char ui_delete_text[];
static const char copy_cmd[];
static const char cut_cmd[];
static const char del_cmd[];
#endif
/* }}} */
+28 -2
View File
@@ -325,8 +325,34 @@ void rename_hovered(){
status |= (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
}
void delete(){
TODO;
void delete(unsigned long passes){
unsigned long i;
unsigned long del_count = 0;
file tmp;
char *cmd;
for (i = 0; i < mid_dir.file_count; i++) {
if (mid_dir.file_list[i].status & FILE_STATUS_SELECTED) {
cmd = parse_cmd(del_cmd, &mid_dir.file_list[i]);
system(cmd);
free(cmd);
del_count++;
}
}
if (del_count != 0) {
for (i = 0; i < passes; i++) {
if (&mid_dir.current_file[i] > mid_dir.file_list + mid_dir.file_count) {
break;
}
cmd = parse_cmd(del_cmd, &mid_dir.current_file[i]);
system(cmd);
free(cmd);
}
}
status |= (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
}
void makedir(){
wclear(win_b);