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

@@ -276,7 +276,7 @@ JNIEXPORT void JNICALL Java_com_omixlab_panopainter_MainActivity_pickExternalCal
App::I->data_path = file_path;
App::I->work_path = file_path;
App::I->rec_path = file_path + "/frames";
pp::platform::legacy::set_legacy_storage_paths({
pp::platform::legacy::set_legacy_android_storage_paths({
App::I->data_path,
App::I->work_path,
App::I->rec_path,
@@ -716,7 +716,7 @@ static int engine_init_display(struct engine* engine) {
if (App::I->data_path.empty() || App::I->data_path == ".")
App::I->data_path = get_data_path();
LOG("data_path %s", App::I->data_path.c_str());
pp::platform::legacy::set_legacy_storage_paths({
pp::platform::legacy::set_legacy_android_storage_paths({
App::I->data_path,
App::I->work_path.empty() ? App::I->data_path : App::I->work_path,
App::I->rec_path,

View File

@@ -70,6 +70,16 @@ What is already real:
- `pp_app_core`
Latest slice:
- `src/platform_legacy/legacy_platform_services.cpp` now reads Android storage
paths from Android-owned retained state instead of the shared legacy
storage-path singleton.
- `src/legacy_app_startup_services.cpp` and `android/src/cpp/main.cpp` now
update Android-owned retained storage paths instead of the shared legacy
storage-path singleton.
- `src/app_events.cpp`, `linux/src/main.cpp`, and
`src/platform_legacy/legacy_platform_state.*` now route the Linux FPS-title
callback through a narrow legacy GLFW title helper instead of reaching into
retained GLFW window state from `App::set_platform_services(...)`.
- `src/platform_apple/apple_platform_state.cpp` no longer reads Apple storage
paths from `pp::platform::legacy::active_legacy_storage_paths()`;
Apple-owned retained state now carries that path bundle.

View File

@@ -78,6 +78,15 @@ Completed, blocked, and superseded task history moved to
the queue is now ordered by code movement instead.
Current slice:
- `src/platform_legacy/legacy_platform_services.cpp` plus
`src/platform_legacy/legacy_platform_state.*` now give Android its own
retained storage-path surface instead of reading the shared legacy singleton.
- `src/legacy_app_startup_services.cpp` and `android/src/cpp/main.cpp` now
write Android-owned retained storage paths.
- `src/app_events.cpp`, `linux/src/main.cpp`, and
`src/platform_legacy/legacy_platform_state.*` now use a narrow GLFW title
helper for Linux FPS-title updates instead of direct retained-window access
in the app event layer.
- `src/platform_apple/apple_platform_state.cpp` now reads Apple storage paths
from Apple-owned retained state rather than the shared legacy storage-path
singleton.

View File

@@ -39,15 +39,6 @@ std::string linux_home_path()
return pw->pw_dir;
}
void linux_update_fps(int frames)
{
static char title_fps[512];
sprintf(title_fps, "PanoPainter - %d fps", frames);
auto* const window = pp::platform::legacy::active_legacy_glfw_window_state().window;
if (window)
glfwSetWindowTitle(window, title_fps);
}
void error_log(int code, const char * s)
{
printf("glfw error: %s", s);

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
}