From 163a40c539e1abafa6b19f2765af7989aa69ef7d Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Tue, 30 Jan 2024 16:16:17 +0000 Subject: [PATCH] Ladybird: Use Core::Environment instead of Core::System::*env() --- Ladybird/HelperProcess.cpp | 5 +++-- Ladybird/Utilities.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Ladybird/HelperProcess.cpp b/Ladybird/HelperProcess.cpp index 198e1484c16..b46ce4a3507 100644 --- a/Ladybird/HelperProcess.cpp +++ b/Ladybird/HelperProcess.cpp @@ -5,6 +5,7 @@ */ #include "HelperProcess.h" +#include ErrorOr> launch_web_content_process( WebView::ViewImplementation& view, @@ -28,7 +29,7 @@ ErrorOr> launch_web_content_process( TRY(Core::System::close(ui_fd)); auto takeover_string = TRY(String::formatted("WebContent:{}", wc_fd)); - TRY(Core::System::setenv("SOCKET_TAKEOVER"sv, takeover_string, true)); + TRY(Core::Environment::set("SOCKET_TAKEOVER"sv, takeover_string, Core::Environment::Overwrite::Yes)); auto webcontent_fd_passing_socket_string = TRY(String::number(wc_fd_passing_fd)); @@ -116,7 +117,7 @@ ErrorOr> launch_generic_server_process(ReadonlySpan #include +#include #include #include #include @@ -45,8 +46,9 @@ static LexicalPath find_prefix(LexicalPath const& application_directory) void platform_init() { s_serenity_resource_root = [] { - auto* home = getenv("XDG_CONFIG_HOME") ?: getenv("HOME"); - if (home != nullptr) { + auto home = Core::Environment::get("XDG_CONFIG_HOME"sv) + .value_or_lazy_evaluated_optional([]() { return Core::Environment::get("HOME"sv); }); + if (home.has_value()) { auto home_lagom = ByteString::formatted("{}/.lagom", home); if (FileSystem::is_directory(home_lagom)) return home_lagom;