summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Applications/SpaceAnalyzer/main.cpp4
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp4
-rw-r--r--Userland/Libraries/LibCore/File.cpp10
-rw-r--r--Userland/Libraries/LibCore/File.h10
4 files changed, 10 insertions, 18 deletions
diff --git a/Userland/Applications/SpaceAnalyzer/main.cpp b/Userland/Applications/SpaceAnalyzer/main.cpp
index cc895304a2..294e52d42a 100644
--- a/Userland/Applications/SpaceAnalyzer/main.cpp
+++ b/Userland/Applications/SpaceAnalyzer/main.cpp
@@ -368,8 +368,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
if (deletion_result.is_error()) {
auto retry_message_result = GUI::MessageBox::show(window,
DeprecatedString::formatted("Failed to delete \"{}\": {}. Retry?",
- deletion_result.error().file,
- static_cast<Error const&>(deletion_result.error())),
+ selected_node_path,
+ deletion_result.error()),
"Deletion failed"sv,
GUI::MessageBox::Type::Error,
GUI::MessageBox::InputType::YesNo);
diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
index 844bd9c32d..a97c6c6645 100644
--- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp
+++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp
@@ -685,12 +685,12 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_delete_action()
auto& error = result.error();
if (is_directory) {
GUI::MessageBox::show(window(),
- DeprecatedString::formatted("Removing directory {} from the project failed: {}", error.file, static_cast<Error const&>(error)),
+ DeprecatedString::formatted("Removing directory {} from the project failed: {}", file, error),
"Removal failed"sv,
GUI::MessageBox::Type::Error);
} else {
GUI::MessageBox::show(window(),
- DeprecatedString::formatted("Removing file {} from the project failed: {}", error.file, static_cast<Error const&>(error)),
+ DeprecatedString::formatted("Removing file {} from the project failed: {}", file, error),
"Removal failed"sv,
GUI::MessageBox::Type::Error);
}
diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp
index 1adf18b5b5..b0337d4a75 100644
--- a/Userland/Libraries/LibCore/File.cpp
+++ b/Userland/Libraries/LibCore/File.cpp
@@ -549,19 +549,19 @@ ErrorOr<void> File::link_file(DeprecatedString const& dst_path, DeprecatedString
return {};
}
-ErrorOr<void, File::RemoveError> File::remove(DeprecatedString const& path, RecursionMode mode, bool force)
+ErrorOr<void> File::remove(DeprecatedString const& path, RecursionMode mode, bool force)
{
struct stat path_stat;
if (lstat(path.characters(), &path_stat) < 0) {
if (!force)
- return RemoveError { path, errno };
+ return Error::from_errno(errno);
return {};
}
if (S_ISDIR(path_stat.st_mode) && mode == RecursionMode::Allowed) {
auto di = DirIterator(path, DirIterator::SkipParentAndBaseDir);
if (di.has_error())
- return RemoveError { path, di.error() };
+ return Error::from_errno(di.error());
while (di.has_next()) {
auto result = remove(di.next_full_path(), RecursionMode::Allowed, true);
@@ -570,10 +570,10 @@ ErrorOr<void, File::RemoveError> File::remove(DeprecatedString const& path, Recu
}
if (rmdir(path.characters()) < 0 && !force)
- return RemoveError { path, errno };
+ return Error::from_errno(errno);
} else {
if (unlink(path.characters()) < 0 && !force)
- return RemoveError { path, errno };
+ return Error::from_errno(errno);
}
return {};
diff --git a/Userland/Libraries/LibCore/File.h b/Userland/Libraries/LibCore/File.h
index a2942d4342..b3d115bc80 100644
--- a/Userland/Libraries/LibCore/File.h
+++ b/Userland/Libraries/LibCore/File.h
@@ -93,15 +93,7 @@ public:
static ErrorOr<DeprecatedString> read_link(DeprecatedString const& link_path);
static ErrorOr<void> link_file(DeprecatedString const& dst_path, DeprecatedString const& src_path);
- struct RemoveError : public Error {
- RemoveError(DeprecatedString f, int error_code)
- : Error(error_code)
- , file(move(f))
- {
- }
- DeprecatedString file;
- };
- static ErrorOr<void, RemoveError> remove(DeprecatedString const& path, RecursionMode, bool force);
+ static ErrorOr<void> remove(DeprecatedString const& path, RecursionMode, bool force);
virtual bool open(OpenMode) override;