mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
LibCore: Make Core::File::open() return a Result<NNRP<File>, String>
It was impractical to return a RefPtr<File> since that left us no way to extract the error string. This is usually needed for the UI, so the old static open() got basically no use.
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Result.h>
|
||||
#include <AK/String.h>
|
||||
#include <LibCore/IODevice.h>
|
||||
|
||||
@@ -36,7 +37,7 @@ class File final : public IODevice {
|
||||
public:
|
||||
virtual ~File() override;
|
||||
|
||||
static RefPtr<File> open(const String& filename, IODevice::OpenMode, mode_t = 0644);
|
||||
static Result<NonnullRefPtr<File>, String> open(const String& filename, IODevice::OpenMode, mode_t = 0644);
|
||||
|
||||
String filename() const { return m_filename; }
|
||||
void set_filename(const StringView& filename) { m_filename = filename; }
|
||||
|
||||
Reference in New Issue
Block a user