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

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
parent e253cf694e
commit c7e62d448c
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;