1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +00:00

LibCore: Move Stream-based file into the Core namespace

This commit is contained in:
Tim Schumacher 2023-02-09 03:02:46 +01:00 committed by Linus Groh
parent a96339b72b
commit 606a3982f3
218 changed files with 748 additions and 643 deletions

View file

@ -9,6 +9,7 @@
#include <AK/JsonValue.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/DirIterator.h>
#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibMain/Main.h>
@ -112,8 +113,8 @@ static ErrorOr<void> mount_all()
bool all_ok = true;
auto process_fstab_entries = [&](StringView path) -> ErrorOr<void> {
auto file_unbuffered = TRY(Core::Stream::File::open(path, Core::Stream::OpenMode::Read));
auto file = TRY(Core::Stream::BufferedFile::create(move(file_unbuffered)));
auto file_unbuffered = TRY(Core::File::open(path, Core::File::OpenMode::Read));
auto file = TRY(Core::BufferedFile::create(move(file_unbuffered)));
while (TRY(file->can_read_line())) {
auto line = TRY(file->read_line(buffer));
@ -148,7 +149,7 @@ static ErrorOr<void> mount_all()
static ErrorOr<void> print_mounts()
{
// Output info about currently mounted filesystems.
auto df = TRY(Core::Stream::File::open("/sys/kernel/df"sv, Core::Stream::OpenMode::Read));
auto df = TRY(Core::File::open("/sys/kernel/df"sv, Core::File::OpenMode::Read));
auto content = TRY(df->read_until_eof());
auto json = TRY(JsonValue::from_string(content));