1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 08:07:45 +00:00

FileManager: Use newly introduced LibCore file management helpers

Most of the functions under FileUtils were removed, except those which
dealt with file deletion, as they spawned MessageBoxes for errors, as
such, those functions were written in terms of Core::File::remove.
This commit is contained in:
Mițca Dumitru 2021-02-21 02:56:28 +02:00 committed by Andreas Kling
parent ecafee86f8
commit 255da9b02b
4 changed files with 20 additions and 216 deletions

View file

@ -580,8 +580,8 @@ void DirectoryView::handle_drop(const GUI::ModelIndex& index, const GUI::DropEve
if (url_to_copy.path() == new_path)
continue;
if (!FileUtils::copy_file_or_directory(url_to_copy.path(), new_path)) {
auto error_message = String::formatted("Could not copy {} into {}.", url_to_copy.to_string(), new_path);
if (auto result = Core::File::copy_file_or_directory(new_path, url_to_copy.path()); result.is_error()) {
auto error_message = String::formatted("Could not copy {} into {}: {}", url_to_copy.to_string(), new_path, result.error().error_code);
GUI::MessageBox::show(window(), error_message, "File Manager", GUI::MessageBox::Type::Error);
} else {
had_accepted_drop = true;