mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:07:45 +00:00
WindowServer: Prefer File::read_until_eof over DeprecatedFile::read_all
This commit is contained in:
parent
f0ee630ee9
commit
5b318dd160
1 changed files with 3 additions and 6 deletions
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <AK/JsonObject.h>
|
#include <AK/JsonObject.h>
|
||||||
#include <LibCore/ConfigFile.h>
|
#include <LibCore/ConfigFile.h>
|
||||||
#include <LibCore/DeprecatedFile.h>
|
|
||||||
#include <LibCore/Process.h>
|
#include <LibCore/Process.h>
|
||||||
#include <WindowServer/KeymapSwitcher.h>
|
#include <WindowServer/KeymapSwitcher.h>
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
|
@ -90,11 +89,9 @@ void KeymapSwitcher::next_keymap()
|
||||||
|
|
||||||
DeprecatedString KeymapSwitcher::get_current_keymap() const
|
DeprecatedString KeymapSwitcher::get_current_keymap() const
|
||||||
{
|
{
|
||||||
auto proc_keymap = Core::DeprecatedFile::construct("/sys/kernel/keymap");
|
auto proc_keymap = Core::File::open("/sys/kernel/keymap"sv, Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors();
|
||||||
if (!proc_keymap->open(Core::OpenMode::ReadOnly))
|
auto proc_keymap_data = proc_keymap->read_until_eof().release_value_but_fixme_should_propagate_errors();
|
||||||
VERIFY_NOT_REACHED();
|
auto json = JsonValue::from_string(proc_keymap_data).release_value_but_fixme_should_propagate_errors();
|
||||||
|
|
||||||
auto json = JsonValue::from_string(proc_keymap->read_all()).release_value_but_fixme_should_propagate_errors();
|
|
||||||
auto const& keymap_object = json.as_object();
|
auto const& keymap_object = json.as_object();
|
||||||
VERIFY(keymap_object.has_string("keymap"sv));
|
VERIFY(keymap_object.has_string("keymap"sv));
|
||||||
return keymap_object.get_deprecated_string("keymap"sv).value();
|
return keymap_object.get_deprecated_string("keymap"sv).value();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue