mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
Ladybird: Use Core::Environment instead of Core::System::*env()
This commit is contained in:
parent
c6b9ce22ef
commit
163a40c539
2 changed files with 7 additions and 4 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "Utilities.h"
|
||||
#include <AK/LexicalPath.h>
|
||||
#include <AK/Platform.h>
|
||||
#include <LibCore/Environment.h>
|
||||
#include <LibCore/ResourceImplementationFile.h>
|
||||
#include <LibCore/System.h>
|
||||
#include <LibFileSystem/FileSystem.h>
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue