mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00
Ladybird: Use Core::Environment instead of Core::System::*env()
This commit is contained in:
parent
c6b9ce22ef
commit
163a40c539
Notes:
sideshowbarker
2024-07-17 03:16:02 +09:00
Author: https://github.com/AtkinsSJ
Commit: 163a40c539
Pull-request: https://github.com/SerenityOS/serenity/pull/23018
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/DanShaders
Reviewed-by: https://github.com/alimpfard
Reviewed-by: https://github.com/shannonbooth
2 changed files with 7 additions and 4 deletions
|
@ -5,6 +5,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "HelperProcess.h"
|
#include "HelperProcess.h"
|
||||||
|
#include <LibCore/Environment.h>
|
||||||
|
|
||||||
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
||||||
WebView::ViewImplementation& view,
|
WebView::ViewImplementation& view,
|
||||||
|
@ -28,7 +29,7 @@ ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_process(
|
||||||
TRY(Core::System::close(ui_fd));
|
TRY(Core::System::close(ui_fd));
|
||||||
|
|
||||||
auto takeover_string = TRY(String::formatted("WebContent:{}", wc_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));
|
auto webcontent_fd_passing_socket_string = TRY(String::number(wc_fd_passing_fd));
|
||||||
|
|
||||||
|
@ -116,7 +117,7 @@ ErrorOr<NonnullRefPtr<Client>> launch_generic_server_process(ReadonlySpan<ByteSt
|
||||||
TRY(Core::System::close(ui_fd_passing_fd));
|
TRY(Core::System::close(ui_fd_passing_fd));
|
||||||
|
|
||||||
auto takeover_string = TRY(String::formatted("{}:{}", server_name, server_fd));
|
auto takeover_string = TRY(String::formatted("{}:{}", server_name, server_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 fd_passing_socket_string = TRY(String::number(server_fd_passing_fd));
|
auto fd_passing_socket_string = TRY(String::number(server_fd_passing_fd));
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "Utilities.h"
|
#include "Utilities.h"
|
||||||
#include <AK/LexicalPath.h>
|
#include <AK/LexicalPath.h>
|
||||||
#include <AK/Platform.h>
|
#include <AK/Platform.h>
|
||||||
|
#include <LibCore/Environment.h>
|
||||||
#include <LibCore/ResourceImplementationFile.h>
|
#include <LibCore/ResourceImplementationFile.h>
|
||||||
#include <LibCore/System.h>
|
#include <LibCore/System.h>
|
||||||
#include <LibFileSystem/FileSystem.h>
|
#include <LibFileSystem/FileSystem.h>
|
||||||
|
@ -45,8 +46,9 @@ static LexicalPath find_prefix(LexicalPath const& application_directory)
|
||||||
void platform_init()
|
void platform_init()
|
||||||
{
|
{
|
||||||
s_serenity_resource_root = [] {
|
s_serenity_resource_root = [] {
|
||||||
auto* home = getenv("XDG_CONFIG_HOME") ?: getenv("HOME");
|
auto home = Core::Environment::get("XDG_CONFIG_HOME"sv)
|
||||||
if (home != nullptr) {
|
.value_or_lazy_evaluated_optional([]() { return Core::Environment::get("HOME"sv); });
|
||||||
|
if (home.has_value()) {
|
||||||
auto home_lagom = ByteString::formatted("{}/.lagom", home);
|
auto home_lagom = ByteString::formatted("{}/.lagom", home);
|
||||||
if (FileSystem::is_directory(home_lagom))
|
if (FileSystem::is_directory(home_lagom))
|
||||||
return home_lagom;
|
return home_lagom;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue