diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-09-14 11:32:56 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-11-19 17:00:10 +0000 |
commit | ed6d353cdd32f5245b798c52a063ef63c482ec08 (patch) | |
tree | d3bee1b0a1c0d67d8289426c31031fae9725b312 /Userland/Utilities/df.cpp | |
parent | 05c3b48e63c0abacb48bc898f5b7cbff266773b2 (diff) | |
download | serenity-ed6d353cdd32f5245b798c52a063ef63c482ec08.zip |
df: Port to Core::Stream
Diffstat (limited to 'Userland/Utilities/df.cpp')
-rw-r--r-- | Userland/Utilities/df.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Userland/Utilities/df.cpp b/Userland/Utilities/df.cpp index 679c6ed012..5ed5a4a202 100644 --- a/Userland/Utilities/df.cpp +++ b/Userland/Utilities/df.cpp @@ -7,9 +7,8 @@ #include <AK/JsonArray.h> #include <AK/JsonObject.h> #include <AK/NumberFormat.h> -#include <AK/String.h> #include <LibCore/ArgsParser.h> -#include <LibCore/File.h> +#include <LibCore/Stream.h> #include <LibMain/Main.h> #include <inttypes.h> #include <stdlib.h> @@ -33,7 +32,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) args_parser.add_option(flag_human_readable, "Print human-readable sizes", "human-readable", 'h'); args_parser.parse(arguments); - auto file = TRY(Core::File::open("/sys/kernel/df", Core::OpenMode::ReadOnly)); + auto file = TRY(Core::Stream::File::open("/sys/kernel/df"sv, Core::Stream::OpenMode::Read)); if (flag_human_readable) { outln("Filesystem Size Used Available Mount point"); @@ -41,7 +40,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) outln("Filesystem Blocks Used Available Mount point"); } - auto file_contents = file->read_all(); + auto file_contents = TRY(file->read_all()); auto json_result = TRY(JsonValue::from_string(file_contents)); auto const& json = json_result.as_array(); json.for_each([](auto& value) { |