mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:07:35 +00:00
FileManager: Use VERIFY() instead of if checks with VERIFY_NOT_REACHED
Besides micro simplifying the code, this will also show the failed condition in the console, instead of vague 'ASSERTION FAILED: false'.
This commit is contained in:
parent
6463bc7eb3
commit
ff6df9f27e
1 changed files with 5 additions and 16 deletions
|
@ -131,8 +131,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
void do_copy(Vector<String> const& selected_file_paths, FileOperation file_operation)
|
void do_copy(Vector<String> const& selected_file_paths, FileOperation file_operation)
|
||||||
{
|
{
|
||||||
if (selected_file_paths.is_empty())
|
VERIFY(!selected_file_paths.is_empty());
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
|
|
||||||
StringBuilder copy_text;
|
StringBuilder copy_text;
|
||||||
if (file_operation == FileOperation::Move) {
|
if (file_operation == FileOperation::Move) {
|
||||||
|
@ -343,9 +342,7 @@ ErrorOr<int> run_in_desktop_mode()
|
||||||
auto cut_action = GUI::CommonActions::make_cut_action(
|
auto cut_action = GUI::CommonActions::make_cut_action(
|
||||||
[&](auto&) {
|
[&](auto&) {
|
||||||
auto paths = directory_view->selected_file_paths();
|
auto paths = directory_view->selected_file_paths();
|
||||||
|
VERIFY(!paths.is_empty());
|
||||||
if (paths.is_empty())
|
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
|
|
||||||
do_copy(paths, FileOperation::Move);
|
do_copy(paths, FileOperation::Move);
|
||||||
},
|
},
|
||||||
|
@ -355,9 +352,7 @@ ErrorOr<int> run_in_desktop_mode()
|
||||||
auto copy_action = GUI::CommonActions::make_copy_action(
|
auto copy_action = GUI::CommonActions::make_copy_action(
|
||||||
[&](auto&) {
|
[&](auto&) {
|
||||||
auto paths = directory_view->selected_file_paths();
|
auto paths = directory_view->selected_file_paths();
|
||||||
|
VERIFY(!paths.is_empty());
|
||||||
if (paths.is_empty())
|
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
|
|
||||||
do_copy(paths, FileOperation::Copy);
|
do_copy(paths, FileOperation::Copy);
|
||||||
},
|
},
|
||||||
|
@ -727,12 +722,9 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
||||||
auto cut_action = GUI::CommonActions::make_cut_action(
|
auto cut_action = GUI::CommonActions::make_cut_action(
|
||||||
[&](auto&) {
|
[&](auto&) {
|
||||||
auto paths = directory_view->selected_file_paths();
|
auto paths = directory_view->selected_file_paths();
|
||||||
|
|
||||||
if (paths.is_empty())
|
if (paths.is_empty())
|
||||||
paths = tree_view_selected_file_paths();
|
paths = tree_view_selected_file_paths();
|
||||||
|
VERIFY(!paths.is_empty());
|
||||||
if (paths.is_empty())
|
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
|
|
||||||
do_copy(paths, FileOperation::Move);
|
do_copy(paths, FileOperation::Move);
|
||||||
refresh_tree_view();
|
refresh_tree_view();
|
||||||
|
@ -743,12 +735,9 @@ ErrorOr<int> run_in_windowed_mode(String const& initial_location, String const&
|
||||||
auto copy_action = GUI::CommonActions::make_copy_action(
|
auto copy_action = GUI::CommonActions::make_copy_action(
|
||||||
[&](auto&) {
|
[&](auto&) {
|
||||||
auto paths = directory_view->selected_file_paths();
|
auto paths = directory_view->selected_file_paths();
|
||||||
|
|
||||||
if (paths.is_empty())
|
if (paths.is_empty())
|
||||||
paths = tree_view_selected_file_paths();
|
paths = tree_view_selected_file_paths();
|
||||||
|
VERIFY(!paths.is_empty());
|
||||||
if (paths.is_empty())
|
|
||||||
VERIFY_NOT_REACHED();
|
|
||||||
|
|
||||||
do_copy(paths, FileOperation::Copy);
|
do_copy(paths, FileOperation::Copy);
|
||||||
refresh_tree_view();
|
refresh_tree_view();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue