Split Android storage paths from legacy fallback

This commit is contained in:
2026-06-17 10:27:01 +02:00
parent 4bef707c81
commit 5491ed4bf5
9 changed files with 76 additions and 18 deletions

View File

@@ -83,6 +83,8 @@ public:
data_path + "/frames",
{},
};
#elif defined(__ANDROID__)
return pp::platform::legacy::active_legacy_android_storage_paths();
#else
return pp::platform::legacy::active_legacy_storage_paths();
#endif

View File

@@ -19,6 +19,12 @@ struct RetainedLegacyStoragePaths final {
pp::platform::PlatformStoragePaths storage_paths;
};
#ifdef __ANDROID__
struct RetainedLegacyAndroidStoragePaths final {
pp::platform::PlatformStoragePaths storage_paths;
};
#endif
struct RetainedLegacyWebPlatformServicesBinding final {
pp::platform::WebPlatformServices* services = nullptr;
};
@@ -29,6 +35,14 @@ struct RetainedLegacyWebPlatformServicesBinding final {
return state;
}
#ifdef __ANDROID__
[[nodiscard]] RetainedLegacyAndroidStoragePaths& retained_legacy_android_storage_paths()
{
static RetainedLegacyAndroidStoragePaths state;
return state;
}
#endif
[[nodiscard]] RetainedLegacyWebPlatformServicesBinding& retained_legacy_web_platform_services_binding()
{
static RetainedLegacyWebPlatformServicesBinding state;
@@ -86,6 +100,16 @@ void set_legacy_glfw_window(GLFWwindow* window)
active_legacy_glfw_window_state().window = window;
}
void set_legacy_glfw_window_title(std::string_view title)
{
auto* const window = active_legacy_glfw_window_state().window;
if (!window)
return;
const std::string title_value(title);
glfwSetWindowTitle(window, title_value.c_str());
}
void acquire_legacy_glfw_render_context()
{
glfwMakeContextCurrent(active_legacy_glfw_window_state().window);
@@ -206,4 +230,16 @@ void set_legacy_storage_paths(pp::platform::PlatformStoragePaths paths)
retained_legacy_storage_paths().storage_paths = std::move(paths);
}
#ifdef __ANDROID__
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_android_storage_paths()
{
return retained_legacy_android_storage_paths().storage_paths;
}
void set_legacy_android_storage_paths(pp::platform::PlatformStoragePaths paths)
{
retained_legacy_android_storage_paths().storage_paths = std::move(paths);
}
#endif
}

View File

@@ -18,6 +18,7 @@ struct RetainedLegacyGlfwWindowState final {
[[nodiscard]] RetainedLegacyGlfwWindowState& active_legacy_glfw_window_state();
void set_legacy_glfw_window(GLFWwindow* window);
void set_legacy_glfw_window_title(std::string_view title);
void acquire_legacy_glfw_render_context();
void present_legacy_glfw_render_context();
void request_legacy_glfw_app_close();
@@ -51,4 +52,9 @@ void save_legacy_web_prepared_file(
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_storage_paths();
void set_legacy_storage_paths(pp::platform::PlatformStoragePaths paths);
#ifdef __ANDROID__
[[nodiscard]] const pp::platform::PlatformStoragePaths& active_legacy_android_storage_paths();
void set_legacy_android_storage_paths(pp::platform::PlatformStoragePaths paths);
#endif
}