implementation of delete
This commit is contained in:
@@ -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 makedir_cmd[] = "mkdir";
|
||||||
static const char copy_cmd[] = "cp -r";
|
static const char copy_cmd[] = "cp -r";
|
||||||
static const char cut_cmd[] = "mv";
|
static const char cut_cmd[] = "mv";
|
||||||
|
static const char del_cmd[] = "rm -r";
|
||||||
|
|
||||||
static const mimetype mimetype_default_cmd[] = {
|
static const mimetype mimetype_default_cmd[] = {
|
||||||
/* mimetype shell command
|
/* mimetype shell command
|
||||||
@@ -154,6 +155,7 @@ static const char ui_rename_text[];
|
|||||||
static const char ui_delete_text[];
|
static const char ui_delete_text[];
|
||||||
static const char copy_cmd[];
|
static const char copy_cmd[];
|
||||||
static const char cut_cmd[];
|
static const char cut_cmd[];
|
||||||
|
static const char del_cmd[];
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|||||||
+28
-2
@@ -325,8 +325,34 @@ void rename_hovered(){
|
|||||||
status |= (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
|
status |= (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
|
||||||
|
|
||||||
}
|
}
|
||||||
void delete(){
|
void delete(unsigned long passes){
|
||||||
TODO;
|
|
||||||
|
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(){
|
void makedir(){
|
||||||
wclear(win_b);
|
wclear(win_b);
|
||||||
|
|||||||
Reference in New Issue
Block a user