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:
@@ -33,11 +33,11 @@
|
||||
|
||||
namespace Core {
|
||||
|
||||
RefPtr<File> File::open(const String& filename, IODevice::OpenMode mode, mode_t permissions)
|
||||
Result<NonnullRefPtr<File>, String> File::open(const String& filename, IODevice::OpenMode mode, mode_t permissions)
|
||||
{
|
||||
auto file = File::construct(filename);
|
||||
if (!file->open_impl(mode, permissions))
|
||||
return nullptr;
|
||||
return String(file->error_string());
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user