mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 18:10:56 +09:00
LibCore: Add a ConfigFile::open() overload for Core::Stream::File
Core::Stream is already used internally, but ironically you could not open a ConfigFile using one!
This commit is contained in:
parent
678b4983cb
commit
f6884235e2
Notes:
sideshowbarker
2024-07-17 04:16:35 +09:00
Author: https://github.com/AtkinsSJ
Commit: f6884235e2
Pull-request: https://github.com/SerenityOS/serenity/pull/15244
Reviewed-by: https://github.com/davidot ✅
Reviewed-by: https://github.com/demostanis
2 changed files with 6 additions and 0 deletions
|
@ -60,6 +60,11 @@ ErrorOr<NonnullRefPtr<ConfigFile>> ConfigFile::open(String const& filename, Allo
|
|||
ErrorOr<NonnullRefPtr<ConfigFile>> ConfigFile::open(String const& filename, int fd)
|
||||
{
|
||||
auto file = TRY(Stream::File::adopt_fd(fd, Stream::OpenMode::ReadWrite));
|
||||
return open(filename, move(file));
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<ConfigFile>> ConfigFile::open(String const& filename, NonnullOwnPtr<Core::Stream::File> file)
|
||||
{
|
||||
auto buffered_file = TRY(Stream::BufferedFile::create(move(file)));
|
||||
|
||||
auto config_file = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ConfigFile(filename, move(buffered_file))));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue