1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:17:45 +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

@ -6,6 +6,7 @@
*/
#include <LibCore/ArgsParser.h>
#include <LibCore/File.h>
#include <LibCore/Stream.h>
#include <LibCore/System.h>
#include <LibGUI/Action.h>
@ -107,7 +108,7 @@ private:
{
StringBuilder adapter_info;
auto file_or_error = Core::Stream::File::open("/sys/kernel/net/adapters"sv, Core::Stream::OpenMode::Read);
auto file_or_error = Core::File::open("/sys/kernel/net/adapters"sv, Core::File::OpenMode::Read);
if (file_or_error.is_error()) {
dbgln("Error: Could not open /sys/kernel/net/adapters: {}", file_or_error.error());
return "";

View file

@ -144,13 +144,13 @@ private:
GUI::Process::spawn_or_show_error(window(), "/bin/SystemMonitor"sv, Array { "-t", m_graph_type == GraphType::Network ? "network" : "graphs" });
}
ErrorOr<JsonValue> get_data_as_json(OwnPtr<Core::Stream::File>& file, StringView filename)
ErrorOr<JsonValue> get_data_as_json(OwnPtr<Core::File>& file, StringView filename)
{
if (file) {
// Seeking to the beginning causes a data refresh!
TRY(file->seek(0, SeekMode::SetPosition));
} else {
file = TRY(Core::Stream::File::open(filename, Core::Stream::OpenMode::Read));
file = TRY(Core::File::open(filename, Core::File::OpenMode::Read));
}
auto file_contents = TRY(file->read_until_eof());
@ -231,9 +231,9 @@ private:
static constexpr u64 const scale_unit = 8000;
u64 m_current_scale { scale_unit };
DeprecatedString m_tooltip;
OwnPtr<Core::Stream::File> m_proc_stat;
OwnPtr<Core::Stream::File> m_proc_mem;
OwnPtr<Core::Stream::File> m_proc_net;
OwnPtr<Core::File> m_proc_stat;
OwnPtr<Core::File> m_proc_mem;
OwnPtr<Core::File> m_proc_net;
};
ErrorOr<int> serenity_main(Main::Arguments arguments)