浏览代码

Utilities/w: Port to Core::Stream

Sam Atkins 2 年之前
父节点
当前提交
fde9cba2a0
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      Userland/Utilities/w.cpp

+ 4 - 3
Userland/Utilities/w.cpp

@@ -7,8 +7,8 @@
 #include <AK/JsonObject.h>
 #include <AK/JsonObject.h>
 #include <AK/JsonValue.h>
 #include <AK/JsonValue.h>
 #include <LibCore/DateTime.h>
 #include <LibCore/DateTime.h>
-#include <LibCore/File.h>
 #include <LibCore/ProcessStatisticsReader.h>
 #include <LibCore/ProcessStatisticsReader.h>
+#include <LibCore/Stream.h>
 #include <LibCore/System.h>
 #include <LibCore/System.h>
 #include <LibMain/Main.h>
 #include <LibMain/Main.h>
 #include <pwd.h>
 #include <pwd.h>
@@ -25,8 +25,9 @@ ErrorOr<int> serenity_main(Main::Arguments)
     TRY(Core::System::unveil("/sys/kernel/processes", "r"));
     TRY(Core::System::unveil("/sys/kernel/processes", "r"));
     TRY(Core::System::unveil(nullptr, nullptr));
     TRY(Core::System::unveil(nullptr, nullptr));
 
 
-    auto file = TRY(Core::File::open("/var/run/utmp", Core::OpenMode::ReadOnly));
-    auto json = TRY(JsonValue::from_string(file->read_all()));
+    auto file = TRY(Core::Stream::File::open("/var/run/utmp"sv, Core::Stream::OpenMode::Read));
+    auto file_contents = TRY(file->read_all());
+    auto json = TRY(JsonValue::from_string(file_contents));
     if (!json.is_object()) {
     if (!json.is_object()) {
         warnln("Error: Could not parse /var/run/utmp");
         warnln("Error: Could not parse /var/run/utmp");
         return 1;
         return 1;