From 3adfdd3257e233b85ea0e943d9663f00e395c9c4 Mon Sep 17 00:00:00 2001 From: circl Date: Sun, 21 Jul 2024 16:50:14 +0200 Subject: [PATCH] UI: Rename s_serenity_resource_root to s_ladybird_resource_root --- Ladybird/Android/src/main/cpp/LadybirdActivity.cpp | 8 ++++---- Ladybird/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp | 4 ++-- Ladybird/Android/src/main/cpp/RequestServerService.cpp | 2 +- Ladybird/Android/src/main/cpp/WebContentService.cpp | 4 ++-- Ladybird/AppKit/Application/ApplicationBridge.cpp | 2 +- Ladybird/Qt/main.cpp | 2 +- Ladybird/Utilities.cpp | 6 +++--- Ladybird/Utilities.h | 2 +- Ladybird/WebContent/main.cpp | 2 +- Ladybird/WebDriver/main.cpp | 2 +- Userland/Utilities/headless-browser.cpp | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Ladybird/Android/src/main/cpp/LadybirdActivity.cpp b/Ladybird/Android/src/main/cpp/LadybirdActivity.cpp index 77f3d9f780b..ba1ab146fbe 100644 --- a/Ladybird/Android/src/main/cpp/LadybirdActivity.cpp +++ b/Ladybird/Android/src/main/cpp/LadybirdActivity.cpp @@ -34,19 +34,19 @@ extern "C" JNIEXPORT void JNICALL Java_org_serenityos_ladybird_LadybirdActivity_initNativeCode(JNIEnv* env, jobject thiz, jstring resource_dir, jstring tag_name, jobject timer_service) { char const* raw_resource_dir = env->GetStringUTFChars(resource_dir, nullptr); - s_serenity_resource_root = raw_resource_dir; + s_ladybird_resource_root = raw_resource_dir; env->ReleaseStringUTFChars(resource_dir, raw_resource_dir); char const* raw_tag_name = env->GetStringUTFChars(tag_name, nullptr); AK::set_log_tag_name(raw_tag_name); env->ReleaseStringUTFChars(tag_name, raw_tag_name); - dbgln("Set resource dir to {}", s_serenity_resource_root); + dbgln("Set resource dir to {}", s_ladybird_resource_root); - auto file_or_error = Core::System::open(MUST(String::formatted("{}/res/icons/48x48/app-browser.png", s_serenity_resource_root)), O_RDONLY); + auto file_or_error = Core::System::open(MUST(String::formatted("{}/res/icons/48x48/app-browser.png", s_ladybird_resource_root)), O_RDONLY); if (file_or_error.is_error()) { dbgln("No resource files, extracting assets..."); - MUST(extract_tar_archive(MUST(String::formatted("{}/ladybird-assets.tar", s_serenity_resource_root)), s_serenity_resource_root)); + MUST(extract_tar_archive(MUST(String::formatted("{}/ladybird-assets.tar", s_ladybird_resource_root)), s_ladybird_resource_root)); } else { dbgln("Found app-browser.png, not re-extracting assets."); dbgln("Hopefully no developer changed the asset files and expected them to be re-extracted!"); diff --git a/Ladybird/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp b/Ladybird/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp index 150210deb40..726fe3f3725 100644 --- a/Ladybird/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp +++ b/Ladybird/Android/src/main/cpp/LadybirdServiceBaseJNI.cpp @@ -36,10 +36,10 @@ Java_org_serenityos_ladybird_LadybirdServiceBase_initNativeCode(JNIEnv* env, job env->GetJavaVM(&global_vm); char const* raw_resource_dir = env->GetStringUTFChars(resource_dir, nullptr); - s_serenity_resource_root = raw_resource_dir; + s_ladybird_resource_root = raw_resource_dir; env->ReleaseStringUTFChars(resource_dir, raw_resource_dir); // FIXME: Use a custom Android version that uses AssetManager to load files. - Core::ResourceImplementation::install(make(MUST(String::formatted("{}/res", s_serenity_resource_root)))); + Core::ResourceImplementation::install(make(MUST(String::formatted("{}/res", s_ladybird_resource_root)))); char const* raw_tag_name = env->GetStringUTFChars(tag_name, nullptr); AK::set_log_tag_name(raw_tag_name); diff --git a/Ladybird/Android/src/main/cpp/RequestServerService.cpp b/Ladybird/Android/src/main/cpp/RequestServerService.cpp index b72361994b4..eecb49348da 100644 --- a/Ladybird/Android/src/main/cpp/RequestServerService.cpp +++ b/Ladybird/Android/src/main/cpp/RequestServerService.cpp @@ -31,7 +31,7 @@ ErrorOr find_certificates(StringView serenity_resource_root) ErrorOr service_main(int ipc_socket) { // Ensure the certificates are read out here. - DefaultRootCACertificates::set_default_certificate_paths(Vector { TRY(find_certificates(s_serenity_resource_root)) }); + DefaultRootCACertificates::set_default_certificate_paths(Vector { TRY(find_certificates(s_ladybird_resource_root)) }); [[maybe_unused]] auto& certs = DefaultRootCACertificates::the(); Core::EventLoop event_loop; diff --git a/Ladybird/Android/src/main/cpp/WebContentService.cpp b/Ladybird/Android/src/main/cpp/WebContentService.cpp index 19e63b22ac8..1240cc81012 100644 --- a/Ladybird/Android/src/main/cpp/WebContentService.cpp +++ b/Ladybird/Android/src/main/cpp/WebContentService.cpp @@ -106,7 +106,7 @@ ErrorOr> bind_service(void (*bind_method)(int)) static ErrorOr load_content_filters() { - auto file_or_error = Core::File::open(ByteString::formatted("{}/res/ladybird/default-config/BrowserContentFilters.txt", s_serenity_resource_root), Core::File::OpenMode::Read); + auto file_or_error = Core::File::open(ByteString::formatted("{}/res/ladybird/default-config/BrowserContentFilters.txt", s_ladybird_resource_root), Core::File::OpenMode::Read); if (file_or_error.is_error()) return file_or_error.release_error(); @@ -133,7 +133,7 @@ static ErrorOr load_content_filters() static ErrorOr load_autoplay_allowlist() { - auto file_or_error = Core::File::open(TRY(String::formatted("{}/res/ladybird/default-config/BrowserAutoplayAllowlist.txt", s_serenity_resource_root)), Core::File::OpenMode::Read); + auto file_or_error = Core::File::open(TRY(String::formatted("{}/res/ladybird/default-config/BrowserAutoplayAllowlist.txt", s_ladybird_resource_root)), Core::File::OpenMode::Read); if (file_or_error.is_error()) return file_or_error.release_error(); diff --git a/Ladybird/AppKit/Application/ApplicationBridge.cpp b/Ladybird/AppKit/Application/ApplicationBridge.cpp index 4a362dc2e0c..9bb2fb10fe2 100644 --- a/Ladybird/AppKit/Application/ApplicationBridge.cpp +++ b/Ladybird/AppKit/Application/ApplicationBridge.cpp @@ -33,7 +33,7 @@ ApplicationBridge::~ApplicationBridge() = default; ErrorOr ApplicationBridge::launch_request_server(Vector const& certificates) { auto request_server_paths = TRY(get_paths_for_helper_process("RequestServer"sv)); - auto protocol_client = TRY(launch_request_server_process(request_server_paths, s_serenity_resource_root, certificates)); + auto protocol_client = TRY(launch_request_server_process(request_server_paths, s_ladybird_resource_root, certificates)); m_impl->request_server_client = move(protocol_client); return {}; diff --git a/Ladybird/Qt/main.cpp b/Ladybird/Qt/main.cpp index bda1527d53c..1254e25670a 100644 --- a/Ladybird/Qt/main.cpp +++ b/Ladybird/Qt/main.cpp @@ -164,7 +164,7 @@ ErrorOr serenity_main(Main::Arguments arguments) // FIXME: Create an abstraction to re-spawn the RequestServer and re-hook up its client hooks to each tab on crash if (!enable_qt_networking) { auto request_server_paths = TRY(get_paths_for_helper_process("RequestServer"sv)); - auto protocol_client = TRY(launch_request_server_process(request_server_paths, s_serenity_resource_root, certificates)); + auto protocol_client = TRY(launch_request_server_process(request_server_paths, s_ladybird_resource_root, certificates)); app.request_server_client = move(protocol_client); } diff --git a/Ladybird/Utilities.cpp b/Ladybird/Utilities.cpp index 37a7121d063..61d5c8e9649 100644 --- a/Ladybird/Utilities.cpp +++ b/Ladybird/Utilities.cpp @@ -25,7 +25,7 @@ constexpr auto libexec_path = STRINGIFY(LADYBIRD_LIBEXECDIR); constexpr auto libexec_path = "libexec"sv; #endif -ByteString s_serenity_resource_root; +ByteString s_ladybird_resource_root; Optional s_mach_server_name; @@ -61,7 +61,7 @@ static LexicalPath find_prefix(LexicalPath const& application_directory) void platform_init() { - s_serenity_resource_root = [] { + s_ladybird_resource_root = [] { auto home = Core::Environment::get("XDG_CONFIG_HOME"sv) .value_or_lazy_evaluated_optional([]() { return Core::Environment::get("HOME"sv); }); if (home.has_value()) { @@ -76,7 +76,7 @@ void platform_init() return find_prefix(LexicalPath(app_dir)).append("share/Lagom"sv).string(); #endif }(); - Core::ResourceImplementation::install(make(MUST(String::from_byte_string(s_serenity_resource_root)))); + Core::ResourceImplementation::install(make(MUST(String::from_byte_string(s_ladybird_resource_root)))); } void copy_default_config_files(StringView config_path) diff --git a/Ladybird/Utilities.h b/Ladybird/Utilities.h index 2c8873cb2ae..53fc4f42e39 100644 --- a/Ladybird/Utilities.h +++ b/Ladybird/Utilities.h @@ -17,6 +17,6 @@ void copy_default_config_files(StringView config_path); ErrorOr application_directory(); ErrorOr> get_paths_for_helper_process(StringView process_name); -extern ByteString s_serenity_resource_root; +extern ByteString s_ladybird_resource_root; Optional mach_server_name(); void set_mach_server_name(ByteString name); diff --git a/Ladybird/WebContent/main.cpp b/Ladybird/WebContent/main.cpp index 55a8129f9ae..ea2121de172 100644 --- a/Ladybird/WebContent/main.cpp +++ b/Ladybird/WebContent/main.cpp @@ -92,7 +92,7 @@ ErrorOr serenity_main(Main::Arguments arguments) StringView command_line {}; StringView executable_path {}; - auto config_path = ByteString::formatted("{}/ladybird/default-config", s_serenity_resource_root); + auto config_path = ByteString::formatted("{}/ladybird/default-config", s_ladybird_resource_root); StringView mach_server_name {}; Vector certificates; int request_server_socket { -1 }; diff --git a/Ladybird/WebDriver/main.cpp b/Ladybird/WebDriver/main.cpp index 77f1815ff59..4ca05b0364d 100644 --- a/Ladybird/WebDriver/main.cpp +++ b/Ladybird/WebDriver/main.cpp @@ -57,7 +57,7 @@ static ErrorOr launch_browser(ByteString const& socket_path, bool use_qt_ static ErrorOr launch_headless_browser(ByteString const& socket_path) { - auto resources = ByteString::formatted("{}/res", s_serenity_resource_root); + auto resources = ByteString::formatted("{}/res", s_ladybird_resource_root); return launch_process("headless-browser"sv, Array { "--resources", diff --git a/Userland/Utilities/headless-browser.cpp b/Userland/Utilities/headless-browser.cpp index 26c4566e9b6..ea115997b43 100644 --- a/Userland/Utilities/headless-browser.cpp +++ b/Userland/Utilities/headless-browser.cpp @@ -651,7 +651,7 @@ ErrorOr serenity_main(Main::Arguments arguments) Vector certificates; platform_init(); - resources_folder = s_serenity_resource_root; + resources_folder = s_ladybird_resource_root; Core::ArgsParser args_parser; args_parser.set_general_help("This utility runs the Browser in headless mode.");