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

@@ -9,7 +9,6 @@
#include <functional>
#ifdef __LINUX__
#include <GLFW/glfw3.h>
#include "platform_linux/linux_platform_services.h"
#endif
#ifdef _WIN32
@@ -62,12 +61,8 @@ void App::set_platform_services(pp::platform::PlatformServices* services) noexce
#ifdef __LINUX__
if (services)
{
pp::platform::linux_desktop::set_fps_title_callback([this](std::string title) {
auto* const window = pp::platform::legacy::active_legacy_glfw_window_state().window;
if (!window)
return;
glfwSetWindowTitle(window, title.c_str());
pp::platform::linux_desktop::set_fps_title_callback([](std::string title) {
pp::platform::legacy::set_legacy_glfw_window_title(title);
});
}
else

View File

@@ -135,12 +135,21 @@ void execute_legacy_app_init_log(App& app)
// TODO: save this path somewhere in the settings, don't overwrite every start
app.work_path = paths.work_path.empty() ? app.data_path : paths.work_path;
#ifdef __ANDROID__
pp::platform::legacy::set_legacy_android_storage_paths({
app.data_path,
app.work_path,
app.rec_path,
app.tmp_path,
});
#else
pp::platform::legacy::set_legacy_storage_paths({
app.data_path,
app.work_path,
app.rec_path,
app.tmp_path,
});
#endif
//LogRemote::I.start();
LogRemote::I.file_init();

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
}