LibCore: Use ErrorOr<T> for Core::File::remove()

This function returns a subclass of Error, which is now possible.
This commit is contained in:
Andreas Kling 2021-11-07 01:31:00 +01:00
commit c7e62d448c
Notes: sideshowbarker 2024-07-18 01:24:03 +09:00
5 changed files with 17 additions and 14 deletions

View file

@ -72,11 +72,15 @@ public:
static String read_link(String const& link_path);
static ErrorOr<void> link_file(String const& dst_path, String const& src_path);
struct RemoveError {
struct RemoveError : public Error {
RemoveError(String f, int error_code)
: Error(error_code)
, file(move(f))
{
}
String file;
OSError error_code;
};
static Result<void, RemoveError> remove(String const& path, RecursionMode, bool force);
static ErrorOr<void, RemoveError> remove(String const& path, RecursionMode, bool force);
virtual bool open(OpenMode) override;