mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
UI: Rename s_serenity_resource_root to s_ladybird_resource_root
This commit is contained in:
parent
922c6bde87
commit
3adfdd3257
Notes:
github-actions[bot]
2024-07-21 22:00:20 +00:00
Author: https://github.com/circl-lastname Commit: https://github.com/LadybirdBrowser/ladybird/commit/3adfdd3257e Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/753 Reviewed-by: https://github.com/ADKaster ✅
11 changed files with 18 additions and 18 deletions
|
@ -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)
|
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);
|
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);
|
env->ReleaseStringUTFChars(resource_dir, raw_resource_dir);
|
||||||
|
|
||||||
char const* raw_tag_name = env->GetStringUTFChars(tag_name, nullptr);
|
char const* raw_tag_name = env->GetStringUTFChars(tag_name, nullptr);
|
||||||
AK::set_log_tag_name(raw_tag_name);
|
AK::set_log_tag_name(raw_tag_name);
|
||||||
env->ReleaseStringUTFChars(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()) {
|
if (file_or_error.is_error()) {
|
||||||
dbgln("No resource files, extracting assets...");
|
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 {
|
} else {
|
||||||
dbgln("Found app-browser.png, not re-extracting assets.");
|
dbgln("Found app-browser.png, not re-extracting assets.");
|
||||||
dbgln("Hopefully no developer changed the asset files and expected them to be re-extracted!");
|
dbgln("Hopefully no developer changed the asset files and expected them to be re-extracted!");
|
||||||
|
|
|
@ -36,10 +36,10 @@ Java_org_serenityos_ladybird_LadybirdServiceBase_initNativeCode(JNIEnv* env, job
|
||||||
env->GetJavaVM(&global_vm);
|
env->GetJavaVM(&global_vm);
|
||||||
|
|
||||||
char const* raw_resource_dir = env->GetStringUTFChars(resource_dir, nullptr);
|
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);
|
env->ReleaseStringUTFChars(resource_dir, raw_resource_dir);
|
||||||
// FIXME: Use a custom Android version that uses AssetManager to load files.
|
// FIXME: Use a custom Android version that uses AssetManager to load files.
|
||||||
Core::ResourceImplementation::install(make<Core::ResourceImplementationFile>(MUST(String::formatted("{}/res", s_serenity_resource_root))));
|
Core::ResourceImplementation::install(make<Core::ResourceImplementationFile>(MUST(String::formatted("{}/res", s_ladybird_resource_root))));
|
||||||
|
|
||||||
char const* raw_tag_name = env->GetStringUTFChars(tag_name, nullptr);
|
char const* raw_tag_name = env->GetStringUTFChars(tag_name, nullptr);
|
||||||
AK::set_log_tag_name(raw_tag_name);
|
AK::set_log_tag_name(raw_tag_name);
|
||||||
|
|
|
@ -31,7 +31,7 @@ ErrorOr<ByteString> find_certificates(StringView serenity_resource_root)
|
||||||
ErrorOr<int> service_main(int ipc_socket)
|
ErrorOr<int> service_main(int ipc_socket)
|
||||||
{
|
{
|
||||||
// Ensure the certificates are read out here.
|
// 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();
|
[[maybe_unused]] auto& certs = DefaultRootCACertificates::the();
|
||||||
|
|
||||||
Core::EventLoop event_loop;
|
Core::EventLoop event_loop;
|
||||||
|
|
|
@ -106,7 +106,7 @@ ErrorOr<NonnullRefPtr<Client>> bind_service(void (*bind_method)(int))
|
||||||
|
|
||||||
static ErrorOr<void> load_content_filters()
|
static ErrorOr<void> 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())
|
if (file_or_error.is_error())
|
||||||
return file_or_error.release_error();
|
return file_or_error.release_error();
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ static ErrorOr<void> load_content_filters()
|
||||||
|
|
||||||
static ErrorOr<void> load_autoplay_allowlist()
|
static ErrorOr<void> 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())
|
if (file_or_error.is_error())
|
||||||
return file_or_error.release_error();
|
return file_or_error.release_error();
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ ApplicationBridge::~ApplicationBridge() = default;
|
||||||
ErrorOr<void> ApplicationBridge::launch_request_server(Vector<ByteString> const& certificates)
|
ErrorOr<void> ApplicationBridge::launch_request_server(Vector<ByteString> const& certificates)
|
||||||
{
|
{
|
||||||
auto request_server_paths = TRY(get_paths_for_helper_process("RequestServer"sv));
|
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);
|
m_impl->request_server_client = move(protocol_client);
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -164,7 +164,7 @@ ErrorOr<int> 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
|
// 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) {
|
if (!enable_qt_networking) {
|
||||||
auto request_server_paths = TRY(get_paths_for_helper_process("RequestServer"sv));
|
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);
|
app.request_server_client = move(protocol_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ constexpr auto libexec_path = STRINGIFY(LADYBIRD_LIBEXECDIR);
|
||||||
constexpr auto libexec_path = "libexec"sv;
|
constexpr auto libexec_path = "libexec"sv;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ByteString s_serenity_resource_root;
|
ByteString s_ladybird_resource_root;
|
||||||
|
|
||||||
Optional<ByteString> s_mach_server_name;
|
Optional<ByteString> s_mach_server_name;
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ static LexicalPath find_prefix(LexicalPath const& application_directory)
|
||||||
|
|
||||||
void platform_init()
|
void platform_init()
|
||||||
{
|
{
|
||||||
s_serenity_resource_root = [] {
|
s_ladybird_resource_root = [] {
|
||||||
auto home = Core::Environment::get("XDG_CONFIG_HOME"sv)
|
auto home = Core::Environment::get("XDG_CONFIG_HOME"sv)
|
||||||
.value_or_lazy_evaluated_optional([]() { return Core::Environment::get("HOME"sv); });
|
.value_or_lazy_evaluated_optional([]() { return Core::Environment::get("HOME"sv); });
|
||||||
if (home.has_value()) {
|
if (home.has_value()) {
|
||||||
|
@ -76,7 +76,7 @@ void platform_init()
|
||||||
return find_prefix(LexicalPath(app_dir)).append("share/Lagom"sv).string();
|
return find_prefix(LexicalPath(app_dir)).append("share/Lagom"sv).string();
|
||||||
#endif
|
#endif
|
||||||
}();
|
}();
|
||||||
Core::ResourceImplementation::install(make<Core::ResourceImplementationFile>(MUST(String::from_byte_string(s_serenity_resource_root))));
|
Core::ResourceImplementation::install(make<Core::ResourceImplementationFile>(MUST(String::from_byte_string(s_ladybird_resource_root))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_default_config_files(StringView config_path)
|
void copy_default_config_files(StringView config_path)
|
||||||
|
|
|
@ -17,6 +17,6 @@ void copy_default_config_files(StringView config_path);
|
||||||
ErrorOr<ByteString> application_directory();
|
ErrorOr<ByteString> application_directory();
|
||||||
ErrorOr<Vector<ByteString>> get_paths_for_helper_process(StringView process_name);
|
ErrorOr<Vector<ByteString>> get_paths_for_helper_process(StringView process_name);
|
||||||
|
|
||||||
extern ByteString s_serenity_resource_root;
|
extern ByteString s_ladybird_resource_root;
|
||||||
Optional<ByteString const&> mach_server_name();
|
Optional<ByteString const&> mach_server_name();
|
||||||
void set_mach_server_name(ByteString name);
|
void set_mach_server_name(ByteString name);
|
||||||
|
|
|
@ -92,7 +92,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
||||||
StringView command_line {};
|
StringView command_line {};
|
||||||
StringView executable_path {};
|
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 {};
|
StringView mach_server_name {};
|
||||||
Vector<ByteString> certificates;
|
Vector<ByteString> certificates;
|
||||||
int request_server_socket { -1 };
|
int request_server_socket { -1 };
|
||||||
|
|
|
@ -57,7 +57,7 @@ static ErrorOr<pid_t> launch_browser(ByteString const& socket_path, bool use_qt_
|
||||||
|
|
||||||
static ErrorOr<pid_t> launch_headless_browser(ByteString const& socket_path)
|
static ErrorOr<pid_t> 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,
|
return launch_process("headless-browser"sv,
|
||||||
Array {
|
Array {
|
||||||
"--resources",
|
"--resources",
|
||||||
|
|
|
@ -651,7 +651,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
Vector<ByteString> certificates;
|
Vector<ByteString> certificates;
|
||||||
|
|
||||||
platform_init();
|
platform_init();
|
||||||
resources_folder = s_serenity_resource_root;
|
resources_folder = s_ladybird_resource_root;
|
||||||
|
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.set_general_help("This utility runs the Browser in headless mode.");
|
args_parser.set_general_help("This utility runs the Browser in headless mode.");
|
||||||
|
|
Loading…
Reference in a new issue