diff --git a/source/ui/section/action/action.h b/source/ui/section/action/action.h index df14462..20b8380 100644 --- a/source/ui/section/action/action.h +++ b/source/ui/section/action/action.h @@ -13,6 +13,7 @@ void action_install_cias(file_info* info, bool* populated); void action_install_cias_delete(file_info* info, bool* populated); void action_copy_contents(file_info* info, bool* populated); void action_delete_contents(file_info* info, bool* populated); +void action_delete_dir(file_info* info, bool* populated); void action_delete_dir_contents(file_info* info, bool* populated); void action_delete_dir_cias(file_info* info, bool* populated); void action_paste_contents(file_info* info, bool* populated); diff --git a/source/ui/section/action/deletecontents.c b/source/ui/section/action/deletecontents.c index 74e458a..8ad1314 100644 --- a/source/ui/section/action/deletecontents.c +++ b/source/ui/section/action/deletecontents.c @@ -122,6 +122,23 @@ void action_delete_contents(file_info* info, bool* populated) { ui_push(prompt_create("Confirmation", "Delete the selected content?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse)); } +void action_delete_dir(file_info* info, bool* populated) { + delete_dir_contents_data* data = (delete_dir_contents_data*) calloc(1, sizeof(delete_dir_contents_data)); + data->base = info; + data->populated = populated; + data->processed = 0; + + Result res = 0; + if(R_FAILED(res = util_populate_contents(&data->contents, &data->total, info->archive, info->path, true, false, NULL, NULL))) { + error_display_res(info, ui_draw_file_info, res, "Failed to retrieve content list."); + + free(data); + return; + } + + ui_push(prompt_create("Confirmation", "Delete the current directory?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse)); +} + void action_delete_dir_contents(file_info* info, bool* populated) { delete_dir_contents_data* data = (delete_dir_contents_data*) calloc(1, sizeof(delete_dir_contents_data)); data->base = info; @@ -136,7 +153,7 @@ void action_delete_dir_contents(file_info* info, bool* populated) { return; } - ui_push(prompt_create("Confirmation", "Delete all contents of the selected directory?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse)); + ui_push(prompt_create("Confirmation", "Delete all contents of the current directory?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse)); } void action_delete_dir_cias(file_info* info, bool* populated) { @@ -153,5 +170,5 @@ void action_delete_dir_cias(file_info* info, bool* populated) { return; } - ui_push(prompt_create("Confirmation", "Delete all CIAs in the selected directory?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse)); + ui_push(prompt_create("Confirmation", "Delete all CIAs in the current directory?", COLOR_TEXT, true, data, NULL, action_delete_dir_contents_draw_top, action_delete_dir_contents_onresponse)); } \ No newline at end of file diff --git a/source/ui/section/files.c b/source/ui/section/files.c index 39af091..0921e59 100644 --- a/source/ui/section/files.c +++ b/source/ui/section/files.c @@ -52,7 +52,7 @@ static list_item cia_files_action_items[CIA_FILES_ACTION_COUNT] = { static u32 directories_action_count = DIRECTORIES_ACTION_COUNT; static list_item directories_action_items[DIRECTORIES_ACTION_COUNT] = { {"Delete all contents", COLOR_TEXT, action_delete_dir_contents}, - {"Delete", COLOR_TEXT, action_delete_contents}, + {"Delete", COLOR_TEXT, action_delete_dir}, {"Copy", COLOR_TEXT, action_copy_contents}, {"Paste", COLOR_TEXT, action_paste_contents}, }; @@ -65,7 +65,7 @@ static list_item cia_directories_action_items[CIA_DIRECTORIES_ACTION_COUNT] = { {"Install and delete all CIAs", COLOR_TEXT, action_install_cias_delete}, {"Delete all CIAs", COLOR_TEXT, action_delete_dir_cias}, {"Delete all contents", COLOR_TEXT, action_delete_dir_contents}, - {"Delete", COLOR_TEXT, action_delete_contents}, + {"Delete", COLOR_TEXT, action_delete_dir}, {"Copy", COLOR_TEXT, action_copy_contents}, {"Paste", COLOR_TEXT, action_paste_contents}, };